Allow CLI expressions with or without spaces (#23) #47

Merged
Vylpes merged 1 commit from cursor/23-expression-without-spaces into release/0.1.0 2026-11-09 15:18:39 +00:00
Member

Summary

Implements #23 so the CLI expression handler ignores whitespace.

Changes

  • Calculator::evaluate strips whitespace, then parses a single binary operator (leading - still belongs to the left operand).
  • CLI help/prompt copy notes that spaces are optional.
  • Tests cover spaced, unspaced, and multi-space inputs, plus existing error cases without spaces.

Verification

  • cargo test — 19 passed (9 unit + 10 integration)
  • cargo run -- cli smoke: 2+3, 2 + 3, 2 + 3, 10-4, 3*7, 15/3 → expected results; 5/0 → division by zero

Notes

Ticket: #23 (please do not auto-close; needs testing first).

Ready for human review/approval.

## Summary Implements #23 so the CLI expression handler ignores whitespace. ## Changes - `Calculator::evaluate` strips whitespace, then parses a single binary operator (leading `-` still belongs to the left operand). - CLI help/prompt copy notes that spaces are optional. - Tests cover spaced, unspaced, and multi-space inputs, plus existing error cases without spaces. ## Verification - `cargo test` — 19 passed (9 unit + 10 integration) - `cargo run -- cli` smoke: `2+3`, `2 + 3`, `2 + 3`, `10-4`, `3*7`, `15/3` → expected results; `5/0` → division by zero ## Notes Ticket: #23 (please do not auto-close; needs testing first). Ready for human review/approval.
Smithy-bot added this to the 0.1.0 milestone 2026-11-09 11:05:45 +00:00
Allow CLI expressions with or without spaces (#23)
All checks were successful
Test / build (push) Successful in 1m30s
cd904f8e4c
Strip whitespace before parsing binary arithmetic so inputs like 2+3 and 2  +  3 evaluate the same as spaced forms. Update CLI copy and tests.
Vylpes approved these changes 2026-11-09 15:18:35 +00:00
Vylpes merged commit b8ccd38e28 into release/0.1.0 2026-11-09 15:18:39 +00:00
Vylpes deleted branch cursor/23-expression-without-spaces 2026-11-09 15:18:39 +00:00
Sign in to join this conversation.
No description provided.