From 762e2311d240218cdc8d5f7ce552e0a8359e195c Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Tue, 22 Apr 2025 15:10:50 -0400 Subject: [PATCH] Add test case for `FOR` loop variable reusing an existing one --- test/asm/for-loop-variable.asm | 13 +++++++++++++ test/asm/for-loop-variable.err | 3 +++ test/asm/for-loop-variable.out | 6 ++++++ 3 files changed, 22 insertions(+) create mode 100644 test/asm/for-loop-variable.asm create mode 100644 test/asm/for-loop-variable.err create mode 100644 test/asm/for-loop-variable.out diff --git a/test/asm/for-loop-variable.asm b/test/asm/for-loop-variable.asm new file mode 100644 index 00000000..8d0be549 --- /dev/null +++ b/test/asm/for-loop-variable.asm @@ -0,0 +1,13 @@ +def x = 4 +for x, x + def x *= 2 + println x +endr +println x + +def y equ 5 +for y, y + def y *= 3 + println y +endr +println y diff --git a/test/asm/for-loop-variable.err b/test/asm/for-loop-variable.err new file mode 100644 index 00000000..b8893821 --- /dev/null +++ b/test/asm/for-loop-variable.err @@ -0,0 +1,3 @@ +error: for-loop-variable.asm(12): + 'y' already defined as constant at for-loop-variable.asm(8) +error: Assembly aborted (1 error)! diff --git a/test/asm/for-loop-variable.out b/test/asm/for-loop-variable.out new file mode 100644 index 00000000..8627d353 --- /dev/null +++ b/test/asm/for-loop-variable.out @@ -0,0 +1,6 @@ +$0 +$2 +$4 +$6 +$4 +$5