summaryrefslogtreecommitdiffhomepage
path: root/tests/00_syntax
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-12-23 20:54:05 +0100
committerJo-Philipp Wich <jo@mein.io>2021-02-17 14:10:51 +0100
commit3756806674da909ec6dc10ad25862b592792604e (patch)
treef2af7e47f8444caaff0a5a33599f381889db24e3 /tests/00_syntax
parent77580a893283f2bde7ab46496bd3a3d7b2fc6784 (diff)
treewide: rewrite ucode interpreter
Replace the former AST walking interpreter implementation with a single pass bytecode compiler and a corresponding virtual machine. The rewrite lays the groundwork for a couple of improvements with will be subsequently implemented: - Ability to precompile ucode sources into binary byte code - Strippable debug information - Reduced runtime memory usage Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'tests/00_syntax')
-rw-r--r--tests/00_syntax/05_block_nesting7
-rw-r--r--tests/00_syntax/13_object_literals1
-rw-r--r--tests/00_syntax/16_for_loop23
-rw-r--r--tests/00_syntax/17_while_loop2
-rw-r--r--tests/00_syntax/19_arrow_functions6
-rw-r--r--tests/00_syntax/21_regex_literals2
6 files changed, 26 insertions, 15 deletions
diff --git a/tests/00_syntax/05_block_nesting b/tests/00_syntax/05_block_nesting
index 7b74adb..fcfd7da 100644
--- a/tests/00_syntax/05_block_nesting
+++ b/tests/00_syntax/05_block_nesting
@@ -8,6 +8,13 @@ In line 2, byte 61:
Near here --------------------------------------------------^
+Syntax error: Template blocks may not be nested
+In line 3, byte 61:
+
+ `We may not nest expression blocks into statement blocks: {% {{ 1 + 2 }} %}.`
+ Near here --------------------------------------------------^
+
+
-- End --
-- Testcase --
diff --git a/tests/00_syntax/13_object_literals b/tests/00_syntax/13_object_literals
index 60c9f32..67dbd6c 100644
--- a/tests/00_syntax/13_object_literals
+++ b/tests/00_syntax/13_object_literals
@@ -48,6 +48,7 @@ either JSON or JavaScript notation.
print(another_obj, "\n");
print(third_obj, "\n");
print(nested_obj, "\n");
+%}
-- End --
diff --git a/tests/00_syntax/16_for_loop b/tests/00_syntax/16_for_loop
index 33d1d97..67edc21 100644
--- a/tests/00_syntax/16_for_loop
+++ b/tests/00_syntax/16_for_loop
@@ -218,11 +218,12 @@ Ensure that for-in loop expressions with more than two variables are
rejected.
-- Expect stderr --
-Syntax error: Invalid for-in expression
-In line 2, byte 14:
+Syntax error: Unexpected token
+Expecting ';'
+In line 2, byte 24:
` for (let x, y, z in {})`
- Near here ------^
+ Near here ----------------^
-- End --
@@ -238,11 +239,12 @@ In line 2, byte 14:
Ensure that assignments in for-in loop expressions are rejected.
-- Expect stderr --
-Syntax error: Invalid for-in expression
-In line 2, byte 13:
+Syntax error: Unexpected token
+Expecting ';'
+In line 2, byte 25:
` for (let x = 1, y in {})`
- Near here -----^
+ Near here -----------------^
-- End --
@@ -259,7 +261,7 @@ Ensure that too short for-in loop expressions are rejected (1/2).
-- Expect stderr --
Syntax error: Unexpected token
-Expecting ',' or 'in'
+Expecting ';'
In line 2, byte 12:
` for (let x)`
@@ -279,11 +281,12 @@ In line 2, byte 12:
Ensure that too short for-in loop expressions are rejected (2/2).
-- Expect stderr --
-Syntax error: Invalid for-in expression
-In line 2, byte 14:
+Syntax error: Unexpected token
+Expecting ';'
+In line 2, byte 15:
` for (let x, y)`
- Near here ------^
+ Near here -------^
-- End --
diff --git a/tests/00_syntax/17_while_loop b/tests/00_syntax/17_while_loop
index 4dfaccc..1e68d6b 100644
--- a/tests/00_syntax/17_while_loop
+++ b/tests/00_syntax/17_while_loop
@@ -32,7 +32,7 @@ Iteration 8
Iteration 9
A counting while-loop using the alternative syntax:
-Iteration null
+Iteration 0
Iteration 1
Iteration 2
Iteration 3
diff --git a/tests/00_syntax/19_arrow_functions b/tests/00_syntax/19_arrow_functions
index 4847d8a..102c527 100644
--- a/tests/00_syntax/19_arrow_functions
+++ b/tests/00_syntax/19_arrow_functions
@@ -108,11 +108,11 @@ subsequent testcase asserts that case.
-- Expect stderr --
Syntax error: Unexpected token
-Expecting Label
-In line 2, byte 5:
+Expecting ';'
+In line 2, byte 10:
` (a + 1) => { print("test\n") }`
- ^-- Near here
+ Near here --^
-- End --
diff --git a/tests/00_syntax/21_regex_literals b/tests/00_syntax/21_regex_literals
index 4aef33f..3af53bb 100644
--- a/tests/00_syntax/21_regex_literals
+++ b/tests/00_syntax/21_regex_literals
@@ -35,7 +35,7 @@ Testing invalid flag characters.
-- Expect stderr --
Syntax error: Unexpected token
-Expecting ',' or ';'
+Expecting ';'
In line 2, byte 8:
` /test/x`