(define-ps-special-form lisp (lisp-form)
;; (ps (foo (lisp bar))) is in effect equivalent to (ps* `(foo ,bar))
;; when called from inside of ps*, lisp-form has access only to the dynamic environment (like for eval)
- `(js:escape ,(ps1* lisp-form)))
+ `(js:escape (ps1* ,lisp-form)))
(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)) (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*)))))))