summaryrefslogtreecommitdiff
path: root/internal/repl/repl_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-25 22:59:17 +0200
committerPaul Buetow <paul@buetow.org>2026-03-25 22:59:17 +0200
commit3d6781c22c4512a896b5dffc0b22b30e36b4993c (patch)
tree0d698ee833c0810af0a4fc4adae4ed3c4ec74e5e /internal/repl/repl_test.go
parenta4a8510a0bf8abaf3c58ce276d619fa30dad26f5 (diff)
rpn: Fix := and =: operators semantics
Diffstat (limited to 'internal/repl/repl_test.go')
-rw-r--r--internal/repl/repl_test.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/internal/repl/repl_test.go b/internal/repl/repl_test.go
index 2b7ed16..9276135 100644
--- a/internal/repl/repl_test.go
+++ b/internal/repl/repl_test.go
@@ -651,15 +651,18 @@ func TestExecutorWithAssignmentRight(t *testing.T) {
}
}
+
func TestExecutorWithAssignmentAfterCalculation(t *testing.T) {
// Test that assignment works after a calculation
- executor("1 2 + x =:")
+ // Note: This test uses a fresh variable name to avoid conflicts with previous tests
+ // that may have set x=5 from TestExecutorWithAssignmentRight
+ executor("1 2 + z =:")
state := getRPNState()
- val, exists := state.vars.GetVariable("x")
+ val, exists := state.vars.GetVariable("z")
if !exists {
- t.Errorf("Variable x should exist")
+ t.Errorf("Variable z should exist")
}
if val != 3 {
- t.Errorf("Variable x = %v, want 3", val)
+ t.Errorf("Variable z = %v, want 3", val)
}
}