Add conditional block parsing failure tests
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 2 Oct 2023 15:55:48 +0000 (11:55 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 2 Oct 2023 16:04:06 +0000 (12:04 -0400)
Change-Id: I49da1387c68b2a521050b449ffe93c00d80f5e87
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
tests/fail-cond-blk-const-int.nt [new file with mode: 0644]
tests/fail-cond-blk-empty-expr.nt [new file with mode: 0644]
tests/fail-cond-blk-eval-type-1.nt [new file with mode: 0644]
tests/fail-cond-blk-eval-type-2.nt [new file with mode: 0644]
tests/fail-cond-blk-eval.nt [new file with mode: 0644]

diff --git a/tests/fail-cond-blk-const-int.nt b/tests/fail-cond-blk-const-int.nt
new file mode 100644 (file)
index 0000000..8f0fb28
--- /dev/null
@@ -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 (file)
index 0000000..ccc1aea
--- /dev/null
@@ -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 (file)
index 0000000..109c25e
--- /dev/null
@@ -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 (file)
index 0000000..2965e73
--- /dev/null
@@ -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 (file)
index 0000000..fa28ad8
--- /dev/null
@@ -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
This page took 0.023911 seconds and 4 git commands to generate.