(test defsetf1
(ps (defsetf baz (x y) (newval) `(set-baz ,x ,y ,newval)))
- (is (string= "var PS_GS_1 = 3; var PS_GS_2 = 2; var PS_GS_3 = 1; setBaz(PS_GS_3, PS_GS_2, PS_GS_1);"
+ (is (string= "var PS_GS_2 = 1; var PS_GS_3 = 2; var PS_GS_1 = 3; setBaz(PS_GS_2, PS_GS_3, PS_GS_1);"
(normalize-js-code (let ((ps::*gen-script-name-counter* 0))
(ps (setf (baz 1 2) 3)))))))
+
+(test defsetf-short
+ (ps (defsetf baz set-baz "blah"))
+ (is (string= "setBaz(1, 2, 3, 'foo');" (normalize-js-code (ps (setf (baz 1 2 3) "foo"))))))
+
+(test-ps-js defun-optional1
+ (defun test-opt (&optional x) (return (if x "yes" "no")))
+ "function testOpt(x) {
+ x = undefined === x && null || x;
+ return x ? 'yes' : 'no';
+}")
+
+(test-ps-js return-nothing
+ (return)
+ "return null")