diff options
Diffstat (limited to 'tests/00_syntax')
-rw-r--r-- | tests/00_syntax/11_misc_literals | 2 | ||||
-rw-r--r-- | tests/00_syntax/16_for_loop | 32 | ||||
-rw-r--r-- | tests/00_syntax/19_arrow_functions | 6 |
3 files changed, 20 insertions, 20 deletions
diff --git a/tests/00_syntax/11_misc_literals b/tests/00_syntax/11_misc_literals index 4b33a78..372741c 100644 --- a/tests/00_syntax/11_misc_literals +++ b/tests/00_syntax/11_misc_literals @@ -9,7 +9,7 @@ The "false" keyword represents a false boolean value: false -- End -- -- Testcase -- -{% local t = { f: function() { return this; } } %} +{% let t = { f: function() { return this; } } %} The "this" keyword refers to the current function context: {{ type(t.f()) }} The "null" keyword represents the null value: {{ "" + null }} The "true" keyword represents a true boolean value: {{ true }} diff --git a/tests/00_syntax/16_for_loop b/tests/00_syntax/16_for_loop index a16e0cc..090f87b 100644 --- a/tests/00_syntax/16_for_loop +++ b/tests/00_syntax/16_for_loop @@ -156,11 +156,11 @@ Item {{ n }} {% endfor %} For-in and counting for loops may declare variables: -{% for (local i = 0; i < 3; i++): %} +{% for (let i = 0; i < 3; i++): %} Iteration {{ i }} {% endfor %} -{% for (local n in [123, 456, 789]): %} +{% for (let n in [123, 456, 789]): %} Item {{ n }} {% endfor %} -- End -- @@ -190,25 +190,25 @@ qrx -- Testcase -- {% - local arr = [ true, false, 123, 456 ]; - local obj = { foo: true, bar: false, baz: 123, qrx: 456 }; + let arr = [ true, false, 123, 456 ]; + let obj = { foo: true, bar: false, baz: 123, qrx: 456 }; // iterating arrays with one loop variable yields the array values - for (local x in arr) + for (let x in arr) print(x, "\n"); // iterating arrays with two loop variables yields the array indexes // and their corresponding values - for (local x, y in arr) + for (let x, y in arr) print([x, y], "\n"); // iterating objects with one loop variable yields the object keys - for (local x in obj) + for (let x in obj) print(x, "\n"); // iterating objects with two loop variables yields the object keys // and their corresponding values - for (local x, y in obj) + for (let x, y in obj) print([x, y], "\n"); %} -- End -- @@ -221,7 +221,7 @@ rejected. Syntax error: Invalid for-in expression In line 2, byte 16: - ` for (local x, y, z in {})` + ` for (let x, y, z in {})` Near here --------^ @@ -229,7 +229,7 @@ In line 2, byte 16: -- Testcase -- {% - for (local x, y, z in {}) + for (let x, y, z in {}) ; %} -- End -- @@ -241,7 +241,7 @@ Ensure that assignments in for-in loop expressions are rejected. Syntax error: Invalid for-in expression In line 2, byte 15: - ` for (local x = 1, y in {})` + ` for (let x = 1, y in {})` Near here -------^ @@ -249,7 +249,7 @@ In line 2, byte 15: -- Testcase -- {% - for (local x = 1, y in {}) + for (let x = 1, y in {}) ; %} -- End -- @@ -262,7 +262,7 @@ Syntax error: Unexpected token Expecting ',' or 'in' In line 2, byte 14: - ` for (local x)` + ` for (let x)` Near here ------^ @@ -270,7 +270,7 @@ In line 2, byte 14: -- Testcase -- {% - for (local x) + for (let x) ; %} -- End -- @@ -282,7 +282,7 @@ Ensure that too short for-in loop expressions are rejected (2/2). Syntax error: Invalid for-in expression In line 2, byte 16: - ` for (local x, y)` + ` for (let x, y)` Near here --------^ @@ -290,7 +290,7 @@ In line 2, byte 16: -- Testcase -- {% - for (local x, y) + for (let x, y) ; %} -- End -- diff --git a/tests/00_syntax/19_arrow_functions b/tests/00_syntax/19_arrow_functions index 0d7aa7a..4847d8a 100644 --- a/tests/00_syntax/19_arrow_functions +++ b/tests/00_syntax/19_arrow_functions @@ -76,11 +76,11 @@ arrow function as method has no this: true {% obj = { method: function() { - local that = this; - local arr = () => { + let that = this; + let arr = () => { print("arrow function uses outher this: ", that == this, "\n"); }; - local fn = function() { + let fn = function() { print("normal function has own this: ", that != this, "\n"); }; |