Added (defun (setf...
[clinton/parenscript.git] / t / reference-tests.lisp
index f509cc7..eba1829 100644 (file)
@@ -1,9 +1,10 @@
-(in-package :js-test)
+(in-package :ps-test)
 ;; Tests of everything in the reference.
 ;; File is generated automatically from the text in reference.lisp by
 ;; the function make-reference-tests-dot-lisp in ref2test.lisp
 ;; so do not edit this file.
-(def-suite ref-tests)
+(eval-when (:compile-toplevel :load-toplevel :execute)
+  (def-suite ref-tests))
 (in-suite ref-tests)
 
 (test-ps-js statements-and-expressions-1
 (test-ps-js object-literals-5
   (with-slots (a b c) this
   (+ a b c))
-  "this.a + this.b + this.c;")
+  "(this).a + (this).b + (this).c;")
 
 (test-ps-js regular-expression-literals-1
   (regex "foobar")
@@ -251,7 +252,7 @@ blafoo(i);")
 
 (test-ps-js assignment-1
   (setf a 1)
-  "a = 1")
+  "a = 1;")
 
 (test-ps-js assignment-2
   (setf a 2 b 3 c 4 x (+ a b c))
@@ -262,15 +263,15 @@ x = a + b + c;")
 
 (test-ps-js assignment-3
   (setf a (1+ a))
-  "a++")
+  "a++;")
 
 (test-ps-js assignment-4
-  (setf a (* 2 3 4 a 4 a))
-  "a *= 2 * 3 * 4 * 4 * a")
+  (setf a (+ a 2 3 4 a))
+  "a += 2 + 3 + 4 + a;")
 
 (test-ps-js assignment-5
   (setf a (- 1 a))
-  "a = 1 - a")
+  "a = 1 - a;")
 
 (test-ps-js single-argument-statements-1
   (return 1)
@@ -430,7 +431,7 @@ x = a + b + c;")
 }")
 
 (test-ps-js the-with-statement-1
-  (with ((create :foo "foo" :i "i"))
+  (with (create :foo "foo" :i "i")
   (alert (+ "i is now intermediary scoped: " i)))
   "with ({ foo : 'foo',
         i : 'i' }) {
@@ -467,11 +468,26 @@ x = a + b + c;")
 ('<a href=\"#\" onclick=\"' + 'javascript:transport();' + '\">link</a>')")
 
 (test-ps-js the-html-generator-4
+  (let ((disabled nil)
+      (authorized t))
+   (setf element.inner-h-t-m-l
+         (html ((:textarea (or disabled (not authorized)) :disabled "disabled")
+                "Edit me"))))
+  " {
+   var disabled = null;
+   var authorized = true;
+   element.innerHTML =
+   '<textarea'
+   + (disabled || !authorized ? ' disabled=\"' + 'disabled' + '\"' : '')
+   + '>Edit me</textarea>';
+ }")
+
+(test-ps-js the-html-generator-5
   (css-inline :color "red"
             :font-size "x-small")
   "'color:red;font-size:x-small'")
 
-(test-ps-js the-html-generator-5
+(test-ps-js the-html-generator-6
   (defun make-color-div(color-name)
     (return (html ((:div :style (css-inline :color color-name))
                    color-name " looks like this."))))
@@ -480,5 +496,3 @@ x = a + b + c;")
     + ' looks like this.</div>';
 }")
 
-
-(run-tests)