summaryrefslogtreecommitdiffhomepage
path: root/tests/00_syntax/13_object_literals
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2021-02-17 14:45:54 +0100
committerJo-Philipp Wich <jo@mein.io>2021-02-17 14:58:05 +0100
commit6d7662f846e031ac52d609dc69349a1816d8e100 (patch)
tree9a4821814a8e7abad4f8e810f05fbd9caac24446 /tests/00_syntax/13_object_literals
parent3756806674da909ec6dc10ad25862b592792604e (diff)
syntax: support ES2015 shorthand property names
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'tests/00_syntax/13_object_literals')
-rw-r--r--tests/00_syntax/13_object_literals36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/00_syntax/13_object_literals b/tests/00_syntax/13_object_literals
index 67dbd6c..e7926ad 100644
--- a/tests/00_syntax/13_object_literals
+++ b/tests/00_syntax/13_object_literals
@@ -91,3 +91,39 @@ of object properties into other objects.
]), "\n");
%}
-- End --
+
+
+ES2015 short hand property notation is supported as well.
+
+-- Expect stdout --
+{ "a": 123, "b": true, "c": "test" }
+-- End --
+
+-- Testcase --
+{%
+ a = 123;
+ b = true;
+ c = "test";
+
+ o = { a, b, c };
+
+ print(o, "\n");
+%}
+-- End --
+
+-- Expect stderr --
+Syntax error: Unexpected token
+Expecting ':'
+In line 2, byte 14:
+
+ ` o = { "foo" };`
+ Near here ------^
+
+
+-- End --
+
+-- Testcase --
+{%
+ o = { "foo" };
+%}
+-- End --