summaryrefslogtreecommitdiff
path: root/internal/rpn/rpn_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-23 23:04:11 +0300
committerPaul Buetow <paul@buetow.org>2026-05-23 23:04:11 +0300
commitd56e16dc85ff3efe7b5865bd27e4804423a6e463 (patch)
tree4d2d94459dd3ea74d71dc26ce2d952419c7d9f02 /internal/rpn/rpn_test.go
parente3978519df6e7ec34627100401805a6bda619f92 (diff)
feat: wire DeleteVariable to OperatorRegistry as 'd' operator
The 'd' token was previously a no-op error. Now it pops a value from the stack and deletes the variable with that name. Accepts Symbol (:x) or StringNum as the variable name. Added DeleteVariable to VariableOperator interface so the operator can call it through the Operator interface. Example: x 5 = :x d vars → No variables defined
Diffstat (limited to 'internal/rpn/rpn_test.go')
-rw-r--r--internal/rpn/rpn_test.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/rpn/rpn_test.go b/internal/rpn/rpn_test.go
index 494e377..6f7deee 100644
--- a/internal/rpn/rpn_test.go
+++ b/internal/rpn/rpn_test.go
@@ -522,9 +522,9 @@ func TestParseAndEvaluateEvaluateErrors(t *testing.T) {
expectedError: "invalid assignment syntax",
},
{
- name: "'d' command not supported",
+ name: "'d' command without operand",
input: "d",
- expectedError: "'d' command not supported as standalone token",
+ expectedError: "insufficient operands for d",
},
{
name: "empty result after evaluation",