"'hi'.toString();")
(test-ps-js method-call-lit-object
- ((@ (create :to-string (lambda () (return "it works"))) to-string))
+ ((@ (create to-string (lambda () (return "it works"))) to-string))
"( { toString : function () { return 'it works'; } } ).toString();")
(test-ps-js method-call-conditional
(is (char= char-before a-parenthesis))))
(test-ps-js simple-slot-value
- (let ((foo (create :a 1)))
+ (let ((foo (create a 1)))
(alert (slot-value foo 'a)))
"var foo = { a : 1 };
alert(foo.a);")
(test-ps-js buggy-slot-value
- (let ((foo (create :a 1))
+ (let ((foo (create a 1))
(slot-name "a"))
(alert (slot-value foo slot-name)))
" var foo = { a : 1 };
};")
(test-ps-js cond-expression-final-t-clause
- (defun foo () (return (cond ((< 1 2) (bar "foo") (* 4 5)) ((= a b) (+ c d)) ((< 1 2 3 4 5) x) (t "foo"))))
+ (defun foo ()
+ (return (cond ((< 1 2) (bar "foo") (* 4 5))
+ ((= a b) (+ c d))
+ ((< 1 2 3 4 5) x)
+ (t "foo"))))
"function foo() {
- return 1 < 2 ? (bar('foo'), 4 * 5) : (a == b ? c + d : (1 < 2 < 3 < 4 < 5 ? x : 'foo'));
+ var _cmp3;
+ var _cmp2;
+ var _cmp1;
+ return 1 < 2 ? (bar('foo'), 4 * 5) : (a == b ? c + d : ((_cmp1 = 2, _cmp2 = 3, _cmp3 = 4, 1 < _cmp1 && _cmp1 < _cmp2 && _cmp2 < _cmp3 && _cmp3 < 5) ? x : 'foo'));
};")
(test-ps-js cond-expression-middle-t-clause ;; should this signal a warning?
:onclick (ps-inline (transport)))
img))
img))
- "document.write(LINKORNOT == 1 ? '<A HREF=\"#\" ONCLICK=\"' + ('javascript:' + 'transport' + '(' + ')') + '\">' + img + '</A>' : img);")
+ "document.write(LINKORNOT == 1 ? '<A HREF=\"#\" ONCLICK=\"' + ('javascript:' + 'transport()') + '\">' + img + '</A>' : img);")
(test-ps-js negate-number-literal ;; ok, this was broken and fixed before, but no one bothered to add the test!
(- 1)
"(window.eval || eval)()(foo, null);")
(test-ps-js slot-value-object-literal
- (slot-value (create :a 1) 'a)
+ (slot-value (create a 1) 'a)
"({ a : 1 }).a;")
(test-ps-js slot-value-lambda
(test-ps-js slot-value-keyword
(slot-value foo :bar)
"foo['bar'];")
+
+(test-ps-js nary-comparison1
+ (lambda () (return (< 1 2 3)))
+ "function () {
+ var _cmp1;
+ return (_cmp1 = 2, 1 < _cmp1 && _cmp1 < 3);
+};")
+
+(test-ps-js chain-slot-value1
+ (chain ($ "foo") (bar x z) frob (baz 5))
+ "$('foo').bar(x, z).frob.baz(5);")
+
+(test-ps-js chain-slot-value2
+ (chain ($ "foo") bar baz)
+ "$('foo').bar.baz;")
+
+(test-ps-js chain-slot-value3
+ (chain ($ "foo") bar (x y) baz)
+ "$('foo').bar.x(y).baz;")