Updated the documentation and test suite to reflect the fact that html is now ps...
[clinton/parenscript.git] / t / ps-tests.lisp
index d5cf80d..e5835df 100644 (file)
@@ -77,11 +77,11 @@ x = 2 + sideEffect() + x + 5;")
 ;; A problem with long nested operator, when the statement spanned several rows
 ;; the rows would not be joined together correctly.
 (test-ps-js bug-dwim-join
-   (alert (html ((:div :id 777
-                       :style (css-inline :border "1pxsssssssssss"
-                                          :font-size "x-small"
-                                          :height (* 2 200)
-                                          :width (* 2 300))))))
+   (alert (ps-html ((:div :id 777
+                          :style (css-inline :border "1pxsssssssssss"
+                                             :font-size "x-small"
+                                             :height (* 2 200)
+                                             :width (* 2 300))))))
    "alert('<div id=\"777\" style=\"'
  + ('border:1pxsssssssssss;font-size:x-small;height:' + 2 * 200 + ';width:'
  + 2 * 300)
@@ -305,3 +305,30 @@ x = 2 + sideEffect() + x + 5;")
 (test-ps-js blank-object-literal
   {}
   "{ }")
+
+(test-ps-js defun-rest1
+  (defun foo (&rest bar) (alert bar[1]))
+  "function foo() {
+    var bar = [];
+    for (var _js2 = 0; _js2 < arguments.length - 0; _js2 = _js2 + 1) {
+        bar[_js2] = arguments[_js2 + 0];
+    };
+    alert(bar[1]);
+}")
+
+(test-ps-js defun-rest2
+  (defun foo (baz &rest bar) (return (+ baz (aref bar 1))))
+  "function foo(baz) {
+    var bar = [];
+    for (var _js2 = 0; _js2 < arguments.length - 1; _js2 = _js2 + 1) {
+        bar[_js2] = arguments[_js2 + 1];
+    };
+    return baz + bar[1];
+}")
+
+(test-ps-js defun-keyword1
+  (defun zoo (foo bar &key baz) (return (+ foo bar baz)))
+  "function zoo(foo, bar, _js1) {
+    _js1 = undefined === _js1 && {  } || _js1;
+    return foo + bar + _js1.baz;
+}")