1 (in-package :parenscript-test
)
3 (eval-when (:compile-toplevel
:load-toplevel
:execute
)
4 (def-suite package-system-tests
))
6 (in-suite package-system-tests
)
8 (test-ps-js operator-packages1
12 (defpackage "PS-TEST.MY-LIBRARY"
14 (setf (ps-package-prefix "PS-TEST.MY-LIBRARY") "my_library_")
16 (test-ps-js lib-function1
17 (defun ps-test.my-library
::library-function
(x y
)
19 "function my_library_libraryFunction(x, y) {
23 (defpackage "PS-TEST.OBFUSCATE-ME")
24 (obfuscate-package "PS-TEST.OBFUSCATE-ME")
26 (test-ps-js obfuscation1
27 (defun ps-test.obfuscate-me
::library-function2
(a b ps-test.obfuscate-me
::foo
)
28 (+ a
(ps-test.my-library
::library-function b ps-test.obfuscate-me
::foo
)))
29 "function g1(a, b, g2) {
30 a + my_library_libraryFunction(b, g2);
33 (defpackage "PS-TEST.OBFUSCATE-AND-PREFIX")
34 (obfuscate-package "PS-TEST.OBFUSCATE-AND-PREFIX")
35 (setf (ps-package-prefix "PS-TEST.OBFUSCATE-AND-PREFIX") "__FOO___")
37 (test-ps-js obfuscate-and-prefix
38 (defun ps-test.obfuscate-and-prefix
::some-function
(a ps-test.obfuscate-and-prefix
::b ps-test.my-library
::d
)
40 (ps-test.obfuscate-me
::library-function2 ps-test.obfuscate-and-prefix
::b a
)
41 (ps-test.my-library
::library-function ps-test.my-library
::d ps-test.obfuscate-and-prefix
::b
)))
42 "function __FOO___g1(a, __FOO___g2, my_library_d) {
43 a * g1(__FOO___g2, a) * my_library_libraryFunction(my_library_d, __FOO___g2);
46 (defpackage "PS-TEST.PSTSTPKG"
50 (setf (ps-package-prefix "PS-TEST.PSTSTPKG") "prefix_")
51 (is (string= "prefix_foo;" (normalize-js-code (ps* 'ps-test.pststpkg
::foo
)))))
53 (common-lisp:in-package
"PS-TEST.PSTSTPKG")
55 (ps-test::test-ps-js namespace-and-special-forms
56 (let* ((foo (create :bar
1 not-a-keyword something
)))
57 (return (and (not foo
) (+ (slot-value foo bar
) some-other-var
))))
60 prefix_notAKeyword : prefix_something };
61 return !prefix_foo && prefix_foo[prefix_bar] + prefix_someOtherVar;")