From 9f2ce91e06d63e6f2e51fe640d3c835e6bcfa11b Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Mon, 2 Oct 2023 11:55:48 -0400 Subject: [PATCH] Add conditional block parsing failure tests Change-Id: I49da1387c68b2a521050b449ffe93c00d80f5e87 Signed-off-by: Philippe Proulx --- tests/fail-cond-blk-const-int.nt | 3 +++ tests/fail-cond-blk-empty-expr.nt | 3 +++ tests/fail-cond-blk-eval-type-1.nt | 3 +++ tests/fail-cond-blk-eval-type-2.nt | 3 +++ tests/fail-cond-blk-eval.nt | 3 +++ 5 files changed, 15 insertions(+) create mode 100644 tests/fail-cond-blk-const-int.nt create mode 100644 tests/fail-cond-blk-empty-expr.nt create mode 100644 tests/fail-cond-blk-eval-type-1.nt create mode 100644 tests/fail-cond-blk-eval-type-2.nt create mode 100644 tests/fail-cond-blk-eval.nt diff --git a/tests/fail-cond-blk-const-int.nt b/tests/fail-cond-blk-const-int.nt new file mode 100644 index 0000000..8f0fb28 --- /dev/null +++ b/tests/fail-cond-blk-const-int.nt @@ -0,0 +1,3 @@ +!if 17 ff !end +--- +1:5 - Expecting a name or `{` diff --git a/tests/fail-cond-blk-empty-expr.nt b/tests/fail-cond-blk-empty-expr.nt new file mode 100644 index 0000000..ccc1aea --- /dev/null +++ b/tests/fail-cond-blk-empty-expr.nt @@ -0,0 +1,3 @@ +!if { } 77 !end +--- +1:6 - Invalid expression ``: invalid syntax diff --git a/tests/fail-cond-blk-eval-type-1.nt b/tests/fail-cond-blk-eval-type-1.nt new file mode 100644 index 0000000..109c25e --- /dev/null +++ b/tests/fail-cond-blk-eval-type-1.nt @@ -0,0 +1,3 @@ +!if { [1, 2, 3] } 77 !end +--- +1:1 - Invalid expression `[1, 2, 3]`: expecting result type `int`, not `list` diff --git a/tests/fail-cond-blk-eval-type-2.nt b/tests/fail-cond-blk-eval-type-2.nt new file mode 100644 index 0000000..2965e73 --- /dev/null +++ b/tests/fail-cond-blk-eval-type-2.nt @@ -0,0 +1,3 @@ +!if {3.4} 77 !end +--- +1:1 - Invalid expression `3.4`: expecting result type `int`, not `float` diff --git a/tests/fail-cond-blk-eval.nt b/tests/fail-cond-blk-eval.nt new file mode 100644 index 0000000..fa28ad8 --- /dev/null +++ b/tests/fail-cond-blk-eval.nt @@ -0,0 +1,3 @@ +aa !if { 23 + zoom(14) } bb !end +--- +1:4 - Failed to evaluate expression `23 + zoom(14)`: name 'zoom' is not defined -- 2.34.1