From dca24a6d500565997156f25544572cd1d4c4dbe3 Mon Sep 17 00:00:00 2001 From: Rangi Date: Sun, 28 Aug 2022 15:34:01 -0400 Subject: [PATCH] Test that `OPT r` fails immediately if the recursion depth is already exceeded Fixes #1034 --- test/asm/opt-r-decrease.asm | 11 +++++++++++ test/asm/opt-r-decrease.err | 2 ++ test/asm/opt-r-decrease.out | 9 +++++++++ 3 files changed, 22 insertions(+) create mode 100644 test/asm/opt-r-decrease.asm create mode 100644 test/asm/opt-r-decrease.err create mode 100644 test/asm/opt-r-decrease.out diff --git a/test/asm/opt-r-decrease.asm b/test/asm/opt-r-decrease.asm new file mode 100644 index 00000000..de3710bd --- /dev/null +++ b/test/asm/opt-r-decrease.asm @@ -0,0 +1,11 @@ +MACRO m + DEF depth += 1 + IF depth == 10 + OPT r9 + ENDC + println "at depth {d:depth}" + m +ENDM + + DEF depth = 0 + m diff --git a/test/asm/opt-r-decrease.err b/test/asm/opt-r-decrease.err new file mode 100644 index 00000000..185e5cf5 --- /dev/null +++ b/test/asm/opt-r-decrease.err @@ -0,0 +1,2 @@ +FATAL: opt-r-decrease.asm(11) -> opt-r-decrease.asm::m(7) -> opt-r-decrease.asm::m(7) -> opt-r-decrease.asm::m(7) -> opt-r-decrease.asm::m(7) -> opt-r-decrease.asm::m(7) -> opt-r-decrease.asm::m(7) -> opt-r-decrease.asm::m(7) -> opt-r-decrease.asm::m(7) -> opt-r-decrease.asm::m(7) -> opt-r-decrease.asm::m(4): + Recursion limit (9) exceeded diff --git a/test/asm/opt-r-decrease.out b/test/asm/opt-r-decrease.out new file mode 100644 index 00000000..34509214 --- /dev/null +++ b/test/asm/opt-r-decrease.out @@ -0,0 +1,9 @@ +at depth 1 +at depth 2 +at depth 3 +at depth 4 +at depth 5 +at depth 6 +at depth 7 +at depth 8 +at depth 9