From 3d6781c22c4512a896b5dffc0b22b30e36b4993c Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 25 Mar 2026 22:59:17 +0200 Subject: rpn: Fix := and =: operators semantics --- internal/repl/repl_test.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'internal/repl/repl_test.go') 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) } } -- cgit v1.2.3