AS a user, I want to be able to type an expression without spaces #23

Open
opened 2025-09-20 13:10:10 +01:00 by Vylpes · 3 comments
Owner

Epic: #21
Story Points: 2


SO THAT the expression handler is less obtuse

Acceptance Criteria

GIVEN I am in the CLI mode
WHEN I type an expression with OR without spaces in it
THEN the expression handler will ignore the spaces

Subtasks

  • Update handler
  • Update tests
Epic: #21 Story Points: 2 --- SO THAT the expression handler is less obtuse ## Acceptance Criteria GIVEN I am in the CLI mode WHEN I type an expression with OR without spaces in it THEN the expression handler will ignore the spaces ## Subtasks - [x] Update handler - [x] Update tests
Vylpes added this to the 0.1.0 milestone 2025-09-20 13:10:10 +01:00
Vylpes changed title from Support without spaces to AS a user, I want to be able to type an expression without spaces 2025-10-30 18:59:34 +00:00
Member

Test Plan

Generated test plan for #23. Fill in Actual Results and Notes during testing.

Test Plan: #23 — AS a user, I want to be able to type an expression without spaces

Issue: #23
Generated: 2026-06-29
Milestone: 0.1.0

Summary

Verify that the CLI expression handler accepts arithmetic input with or without spaces, treating whitespace as ignorable while preserving existing spaced-expression behavior and error handling.

Test Cases

Id Description Expected Results Actual Results Notes
23-0001 Start interactive CLI (calculator cli). Enter 2 + 3 Output shows = 5 Acceptance criterion — with spaces
23-0002 In interactive CLI, enter 2+3 Output shows = 5 Acceptance criterion — without spaces
23-0003 Run calculator cli "2+3" (single-expression mode) Prints 5 to stdout Without spaces, non-interactive
23-0004 In interactive CLI, enter 10-4 Output shows = 6 Subtraction without spaces
23-0005 In interactive CLI, enter 3*7 Output shows = 21 Multiplication without spaces
23-0006 In interactive CLI, enter 15/3 Output shows = 5 Division without spaces
23-0007 In interactive CLI, enter 2 + 3 (multiple spaces) Output shows = 5 Spaces are ignored, not required
23-0008 In interactive CLI, enter each spaced expression: 2 + 3, 10 - 4, 3 * 7, 15 / 3 Each evaluates to 5, 6, 21, and 5 respectively Regression — spaced input still works
23-0009 In interactive CLI, enter 5/0 Error message: division by zero Error handling unchanged
23-0010 In interactive CLI, enter 2+ Error message: invalid expression Malformed input without spaces
23-0011 In interactive CLI, enter invalid Error message: invalid expression Non-numeric input rejected
23-0012 Run calculator cli "2 + 3" (single-expression mode, with spaces) Prints 5 to stdout Regression — spaced single-expression mode
## Test Plan Generated test plan for #23. Fill in **Actual Results** and **Notes** during testing. # Test Plan: #23 — AS a user, I want to be able to type an expression without spaces **Issue:** https://git.vylpes.xyz/RabbitLabs/calculator/issues/23 **Generated:** 2026-06-29 **Milestone:** 0.1.0 ## Summary Verify that the CLI expression handler accepts arithmetic input with or without spaces, treating whitespace as ignorable while preserving existing spaced-expression behavior and error handling. ## Test Cases | Id | Description | Expected Results | Actual Results | Notes | |----|-------------|------------------|----------------|-------| | 23-0001 | Start interactive CLI (`calculator cli`). Enter `2 + 3` | Output shows `= 5` | | Acceptance criterion — with spaces | | 23-0002 | In interactive CLI, enter `2+3` | Output shows `= 5` | | Acceptance criterion — without spaces | | 23-0003 | Run `calculator cli "2+3"` (single-expression mode) | Prints `5` to stdout | | Without spaces, non-interactive | | 23-0004 | In interactive CLI, enter `10-4` | Output shows `= 6` | | Subtraction without spaces | | 23-0005 | In interactive CLI, enter `3*7` | Output shows `= 21` | | Multiplication without spaces | | 23-0006 | In interactive CLI, enter `15/3` | Output shows `= 5` | | Division without spaces | | 23-0007 | In interactive CLI, enter `2 + 3` (multiple spaces) | Output shows `= 5` | | Spaces are ignored, not required | | 23-0008 | In interactive CLI, enter each spaced expression: `2 + 3`, `10 - 4`, `3 * 7`, `15 / 3` | Each evaluates to `5`, `6`, `21`, and `5` respectively | | Regression — spaced input still works | | 23-0009 | In interactive CLI, enter `5/0` | Error message: division by zero | | Error handling unchanged | | 23-0010 | In interactive CLI, enter `2+` | Error message: invalid expression | | Malformed input without spaces | | 23-0011 | In interactive CLI, enter `invalid` | Error message: invalid expression | | Non-numeric input rejected | | 23-0012 | Run `calculator cli "2 + 3"` (single-expression mode, with spaces) | Prints `5` to stdout | | Regression — spaced single-expression mode |
Vylpes referenced this issue from a commit 2026-06-29 15:32:48 +01:00
Vylpes self-assigned this 2026-09-08 10:58:07 +01:00
Vylpes removed their assignment 2026-09-23 18:09:52 +01:00
Vylpes added this to the 0.1 Sprint 2 project 2026-09-23 18:41:24 +01:00
Smithy-bot canceled time tracking 2026-11-09 11:05:02 +00:00
Smithy-bot removed their assignment 2026-11-09 11:05:49 +00:00
Member

Implemented — ready for review

PR: #47
Branch: cursor/23-expression-without-spaces → release/0.1.0

What changed

  • Expression parser now strips whitespace before finding the binary operator, so 2+3, 2 + 3, and 2 + 3 all evaluate the same.
  • CLI prompt/help notes that spaces are optional.
  • Added/extended tests for unspaced and multi-space inputs (error paths covered without spaces too).

Local verification

  • cargo test — 19 passed
  • CLI smoke: 2+3 / 2 + 3 / 2 + 3 / 10-4 / 3*7 / 15/3 OK; 5/0 → division by zero

Moved to step/review and assigned to @Vylpes. Please approve/merge when ready (I will not approve or merge this PR).

## Implemented — ready for review PR: https://git.vylpes.xyz/RabbitLabs/calculator/pulls/47 Branch: `cursor/23-expression-without-spaces` → `release/0.1.0` ### What changed - Expression parser now strips whitespace before finding the binary operator, so `2+3`, `2 + 3`, and `2 + 3` all evaluate the same. - CLI prompt/help notes that spaces are optional. - Added/extended tests for unspaced and multi-space inputs (error paths covered without spaces too). ### Local verification - `cargo test` — 19 passed - CLI smoke: `2+3` / `2 + 3` / `2 + 3` / `10-4` / `3*7` / `15/3` OK; `5/0` → division by zero Moved to `step/review` and assigned to @Vylpes. Please approve/merge when ready (I will not approve or merge this PR).
Smithy-bot added spent time 2026-11-09 11:05:56 +00:00
5 minutes
Vylpes removed their assignment 2026-11-09 15:18:57 +00:00
Smithy-bot canceled time tracking 2026-11-10 11:03:52 +00:00
Smithy-bot removed their assignment 2026-11-10 11:07:33 +00:00
Member

QA — PASS (step/testing → step/uat)

Ref: release/0.1.0 @ b8ccd38 (PR #47 merge)
Env: rustc/cargo 1.99.1, cargo test --locked, release CLI binary vyxcalc

Automated

  • cargo test --locked — 19 passed (9 unit + 10 integration), including test_expressions_without_spaces / test_expressions_ignore_extra_whitespace

Test plan results (from comment above)

Id Actual
23-0001 PASS — interactive 2 + 3 → = 5
23-0002 PASS — interactive 2+3 → = 5
23-0003 PASS — vyxcalc cli "2+3" → 5
23-0004 PASS — 10-4 → = 6 / 6
23-0005 PASS — 3*7 → = 21 / 21
23-0006 PASS — 15/3 → = 5 / 5
23-0007 PASS — 2 + 3 → = 5 / 5
23-0008 PASS — spaced ops still work
23-0009 PASS — 5/0 → Error: Division by zero
23-0010 PASS — 2+ → Error: Invalid expression
23-0011 PASS — invalid → Error: Invalid expression
23-0012 PASS — vyxcalc cli "2 + 3" → 5

Moved to step/uat and assigned to @Vylpes for human UAT / close.

## QA — PASS (step/testing → step/uat) **Ref:** `release/0.1.0` @ `b8ccd38` (PR #47 merge) **Env:** rustc/cargo 1.99.1, `cargo test --locked`, release CLI binary `vyxcalc` ### Automated - `cargo test --locked` — **19 passed** (9 unit + 10 integration), including `test_expressions_without_spaces` / `test_expressions_ignore_extra_whitespace` ### Test plan results (from comment above) | Id | Actual | |----|--------| | 23-0001 | PASS — interactive `2 + 3` → `= 5` | | 23-0002 | PASS — interactive `2+3` → `= 5` | | 23-0003 | PASS — `vyxcalc cli "2+3"` → `5` | | 23-0004 | PASS — `10-4` → `= 6` / `6` | | 23-0005 | PASS — `3*7` → `= 21` / `21` | | 23-0006 | PASS — `15/3` → `= 5` / `5` | | 23-0007 | PASS — `2 + 3` → `= 5` / `5` | | 23-0008 | PASS — spaced ops still work | | 23-0009 | PASS — `5/0` → `Error: Division by zero` | | 23-0010 | PASS — `2+` → `Error: Invalid expression` | | 23-0011 | PASS — `invalid` → `Error: Invalid expression` | | 23-0012 | PASS — `vyxcalc cli "2 + 3"` → `5` | Moved to `step/uat` and assigned to @Vylpes for human UAT / close.
Smithy-bot added spent time 2026-11-10 11:07:39 +00:00
5 minutes
Sign in to join this conversation.
No description provided.