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 (test-ps-js uniform-symbol-handling1
24 (progn (create 'ps-test.my-library
::foo
1)
25 (create ps-test.my-library
::foo
1)
26 (slot-value foo
'ps-test.my-library
::foo
))
27 "{ 'my_library_foo' : 1 };
28 { my_library_foo : 1 };
31 (defpackage "PS-TEST.OBFUSCATE-ME")
32 (obfuscate-package "PS-TEST.OBFUSCATE-ME")
34 (test-ps-js obfuscation1
35 (defun ps-test.obfuscate-me
::library-function2
(a b ps-test.obfuscate-me
::foo
)
36 (+ a
(ps-test.my-library
::library-function b ps-test.obfuscate-me
::foo
)))
37 "function g1(a, b, g2) {
38 a + my_library_libraryFunction(b, g2);
41 (defpackage "PS-TEST.OBFUSCATE-AND-PREFIX")
42 (obfuscate-package "PS-TEST.OBFUSCATE-AND-PREFIX")
43 (setf (ps-package-prefix "PS-TEST.OBFUSCATE-AND-PREFIX") "__FOO___")
45 (test-ps-js obfuscate-and-prefix
46 (defun ps-test.obfuscate-and-prefix
::some-function
(a ps-test.obfuscate-and-prefix
::b ps-test.my-library
::d
)
48 (ps-test.obfuscate-me
::library-function2 ps-test.obfuscate-and-prefix
::b a
)
49 (ps-test.my-library
::library-function ps-test.my-library
::d ps-test.obfuscate-and-prefix
::b
)))
50 "function __FOO___g1(a, __FOO___g2, my_library_d) {
51 a * g1(__FOO___g2, a) * my_library_libraryFunction(my_library_d, __FOO___g2);
54 (defpackage "PS-TEST.PSTSTPKG"
58 (setf (ps-package-prefix "PS-TEST.PSTSTPKG") "prefix_")
59 (is (string= "prefix_foo;" (normalize-js-code (ps* 'ps-test.pststpkg
::foo
)))))
61 (common-lisp:in-package
"PS-TEST.PSTSTPKG")
63 (ps-test::test-ps-js namespace-and-special-forms
64 (let ((foo (create bar
1 not-a-keyword something
)))
65 (return (and (not foo
) (+ (slot-value foo
'bar
) some-other-var
))))
66 "var prefix_foo1 = { prefix_bar : 1, prefix_notAKeyword : prefix_something };
67 return !prefix_foo1 && prefix_foo1.prefix_bar + prefix_someOtherVar;")