Verified Commit 35843baf authored by Vladimir Sedach's avatar Vladimir Sedach
Browse files

Tests to clarify behavior of SYMBOL-MACROLET wrt CREATE and GETPROP

parent 99fc3eb3
...@@ -1173,6 +1173,10 @@ __setf_someThing('foo', 1, 2);") ...@@ -1173,6 +1173,10 @@ __setf_someThing('foo', 1, 2);")
(getprop (progn (some-fun "abc") "123") "length") (getprop (progn (some-fun "abc") "123") "length")
"(someFun('abc'), '123')['length'];") "(someFun('abc'), '123')['length'];")
(test-ps-js getprop-multi1
(getprop foo 1 "two" three 'bar 1 2)
"foo[1]['two'][three].bar[1][2];")
(test-ps-js method-call-block (test-ps-js method-call-block
((@ (progn (some-fun "abc") "123") to-string)) ((@ (progn (some-fun "abc") "123") to-string))
"(someFun('abc'), '123').toString();") "(someFun('abc'), '123').toString();")
...@@ -2015,10 +2019,35 @@ return x + x; ...@@ -2015,10 +2019,35 @@ return x + x;
"[1];") "[1];")
(test-ps-js symbol-macro-obj (test-ps-js symbol-macro-obj
(symbol-macrolet ((x y)) (symbol-macrolet ((x (+ 1 2)))
(create x 1)) (create x 1))
"({ x : 1 });") "({ x : 1 });")
(test-ps-js symbol-macro-obj1
(symbol-macrolet ((x (+ 1 2)))
(ps:create x x))
"({ x : 1 + 2 });")
(test-ps-js symbol-macro-getprop1
(symbol-macrolet ((x (+ 1 2)))
(ps:getprop a x))
"a[1 + 2];")
(test-ps-js symbol-macro-getprop1
(symbol-macrolet ((x (+ 1 2)))
(ps:getprop a 'x))
"a.x;")
(test-ps-js let-let-create
(let ((a 99))
(let ((a 22))
(create a 33)))
"(function () {
var a = 99;
var a1 = 22;
return { a : 33 };
})();")
(test-ps-js symbol-macro-conditional1 (test-ps-js symbol-macro-conditional1
(symbol-macrolet ((x y)) (symbol-macrolet ((x y))
(if x x x)) (if x x x))
......
...@@ -81,6 +81,11 @@ return !foo1 && foo1.prefix_bar + prefix_someOtherVar; ...@@ -81,6 +81,11 @@ return !foo1 && foo1.prefix_bar + prefix_someOtherVar;
return prefix_baz + gpp; return prefix_baz + gpp;
};") };")
(parenscript.tests::test-ps-js prefixed-symbol-macro-obj1
(symbol-macrolet ((x (+ 1 2)))
(ps:create x x))
"({ prefix_x : 1 + 2 });")
(cl:in-package #:parenscript.tests) (cl:in-package #:parenscript.tests)
(test compile-stream-in-package (test compile-stream-in-package
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment