+
+(test-ps-js special-var1
+ (progn (defvar *foo*) (let* ((*foo* 2)) (* *foo* 2)))
+ "var FOO;
+var tempstackvar1;
+try {
+ tempstackvar1 = FOO;
+ FOO = 2;
+ FOO * 2;
+} finally {
+ FOO = tempstackvar1;
+ delete tempstackvar1;
+};")
+
+(test-ps-js special-var2
+ (progn (defvar *foo*) (let* ((*baz* 3) (*foo* 2)) (* *foo* 2 *baz*)))
+ "var FOO;
+var BAZ = 3;
+var tempstackvar1;
+try {
+ tempstackvar1 = FOO;
+ FOO = 2;
+ FOO * 2 * BAZ;
+} finally {
+ FOO = tempstackvar1;
+ delete tempstackvar1;
+};
+")
+
+(test-ps-js literal1
+ (setf x undefined)
+ "x = undefined;")
+
+(test-ps-js literal2
+ (aref this x)
+ "this[x]")
+
+(test-ps-js setf-dec1
+ (setf x (- 1 x 2))
+ "x = 1 - x - 2;")
+
+(test-ps-js setf-dec2
+ (setf x (- x 1 2))
+ "x = x - 1 - 2;")
+
+(test-ps-js special-char-equals
+ blah=
+ "blahequals")
+
+(test-ps-js setf-operator-priority
+ (return (or (slot-value cache id)
+ (setf (slot-value cache id) (document.get-element-by-id id))))
+ "return cache[id] || (cache[id] = document.getElementById(id))")
+
+(test-ps-js aref-operator-priority
+ (aref (if (and x (> (length x) 0))
+ (aref x 0)
+ y)
+ z)
+ "(x && x.length > 0 ? x[0] : y)[z]")
+
+(test-ps-js aref-operator-priority1
+ (aref (or (slot-value x 'y)
+ (slot-value a 'b))
+ z)
+ "(x.y || a.b)[z]")
+
+(test-ps-js aref-operator-priority2
+ (aref (if a b c) 0)
+ "(a ? b : c)[0]")
+
+(test-ps-js negative-operator-priority
+ (- (if x y z))
+ "-(x ? y : z)")
+
+(test-ps-js op-p1
+ (new (or a b))
+ "new (a || b)")
+
+(test-ps-js op-p2
+ (delete (if a (or b c) d))
+ "delete (a ? b || c : d)")
+
+(test-ps-js op-p3
+ (not (if (or x (not y)) z))
+ "!(x || !y ? z : null)")
+
+(test-ps-js op-p4
+ (- (- (* 1 2) 3))
+ "-(1 * 2 - 3)")
+
+(test-ps-js op-p5
+ (instanceof (or a b) (if x y z))
+ "((a || b) instanceof (x ? y : z))")
+
+(test-ps-js op-p7
+ (or x (if (= x 0) "zero" "empty"))
+ "x || (x == 0 ? 'zero' : 'empty')")
+
+(test-ps-js named-op-expression
+ (throw (if a b c))
+ "throw a ? b : c")
+
+(test-ps-js named-op-expression1
+ (typeof (or x y))
+ "typeof (x || y)")
+
+(test-ps-js aref-array-expression
+ (aref (or a b c) 0)
+ "(a || b || c)[0]")
+
+(test-ps-js slot-value-operator
+ (slot-value (or a b c) 'd)
+ "(a || b || c).d")
+
+(test-ps-js slot-value-parens
+ (slot-value (slot-value foo 'bar) 'baz)
+ "foo.bar.baz")
+
+(test-ps-js funcall-funcall
+ ((foo))
+ "foo()()")
+
+(test-ps-js expression-funcall
+ ((or (@ window eval) eval) foo nil)
+ "(window.eval || eval)(foo, null)")
+
+(test-ps-js expression-funcall1
+ (((or (@ window eval) eval) foo nil))
+ "(window.eval || eval)(foo, null)()")
+
+(test-ps-js expression-funcall2
+ (((or (@ window eval) eval)) foo nil)
+ "(window.eval || eval)()(foo, null)")
+
+(test-ps-js slot-value-object-literal
+ (slot-value (create :a 1) 'a)
+ "({ a : 1 }).a")
+
+(test-ps-js slot-value-lambda
+ (slot-value (lambda ()) 'prototype)
+ "(function () { }).prototype")
+
+(test-ps-js who-html1
+ (who-ps-html (:span :class "ticker-symbol"
+ :ticker-symbol symbol
+ (:a :href "http://foo.com"
+ symbol)
+ (:span :class "ticker-symbol-popup")))
+ "'<SPAN CLASS=\"ticker-symbol\" TICKER-SYMBOL=\"' + symbol + '\"><A HREF=\"http://foo.com\">' + symbol + '</A><SPAN CLASS=\"ticker-symbol-popup\"></SPAN></SPAN>'")
+
+(test-ps-js flet1
+ ((lambda () (flet ((foo (x) (return (1+ x)))) (return (foo 1)))))
+ "(function () {
+ var foo = function (x) {
+ return x + 1;
+ };
+ return foo(1);
+})()")
+
+(test-ps-js labels1
+ ((lambda () (labels ((foo (x)
+ (return (if (=== 0 x)
+ 0
+ (+ x (foo (1- x)))))))
+ (return (foo 3)))))
+ "(function () {
+ var foo = function foo(x) {
+ return 0 === x ? 0 : x + foo(x - 1);
+ };
+ return foo(3);
+})()")
+
+(test-ps-js for-loop-var-init-exp
+ ((lambda (x)
+ (return (do* ((y (if x 0 1) (1+ y))
+ (z 0 (1+ z)))
+ ((= y 3) z))))
+ true)
+ "(function (x) {
+ return (function () {
+ for (var y = x ? 0 : 1, z = 0; y != 3; y += 1, z += 1) {
+ };
+ return z;
+ })();
+})(true)")
+
+(test-ps-js math-pi
+ pi
+ "Math.PI")
+
+(test-ps-js literal-array
+ '(1 2 3)
+ "[1, 2, 3]")
+
+(test-ps-js literal-array-1
+ '(1 foo 3)
+ "[1, 'foo', 3]")
+
+(test ps-lisp-expands-in-lexical-environment
+ (is (string= "5;" (let ((x 5)) (ps (lisp x))))))
+
+(test ps*-lisp-expands-in-null-lexical-environment
+ (signals error (let ((x 5)) (declare (ignore x)) (ps* '(lisp x)))))
+
+(test ps*-lisp-expands-in-dynamic-environment
+ (is (string= "1 + 2;" (let ((*print-level* 2)) (ps* '(+ 1 (lisp *print-level*)))))))
+
+(test ps-lisp-dynamic-environment
+ (is (string= "1 + 2;" (let ((*print-level* 2)) (ps (+ 1 (lisp *print-level*)))))))