1 (in-package "PARENSCRIPT-TEST")
3 (in-suite package-system-tests
)
5 (test-ps-js operator-packages1
9 (defpackage "PS-TEST.MY-LIBRARY"
11 (setf (ps-package-prefix "PS-TEST.MY-LIBRARY") "my_library_")
13 (test-ps-js lib-function1
14 (defun ps-test.my-library
::library-function
(x y
)
16 "function my_library_libraryFunction(x, y) {
20 (test-ps-js uniform-symbol-handling1
21 (progn (create ps-test.my-library
::foo
1)
22 (getprop foo
'ps-test.my-library
::foo
))
23 "{ my_library_foo : 1 };
26 (defpackage "PS-TEST.OBFUSCATE-ME")
27 (obfuscate-package "PS-TEST.OBFUSCATE-ME")
29 (test-ps-js obfuscation1
30 (defun ps-test.obfuscate-me
::library-function2
(a b ps-test.obfuscate-me
::foo
)
31 (+ a
(ps-test.my-library
::library-function b ps-test.obfuscate-me
::foo
)))
32 "function g1(a, b, g2) {
33 return a + my_library_libraryFunction(b, g2);
36 (defpackage "PS-TEST.OBFUSCATE-AND-PREFIX")
37 (obfuscate-package "PS-TEST.OBFUSCATE-AND-PREFIX")
38 (setf (ps-package-prefix "PS-TEST.OBFUSCATE-AND-PREFIX") "__FOO___")
40 (test-ps-js obfuscate-and-prefix
41 (defun ps-test.obfuscate-and-prefix
::some-function
(a ps-test.obfuscate-and-prefix
::b ps-test.my-library
::d
)
43 (ps-test.obfuscate-me
::library-function2 ps-test.obfuscate-and-prefix
::b a
)
44 (ps-test.my-library
::library-function ps-test.my-library
::d ps-test.obfuscate-and-prefix
::b
)))
45 "function __FOO___g1(a, __FOO___g2, my_library_d) {
46 return a * g1(__FOO___g2, a) * my_library_libraryFunction(my_library_d, __FOO___g2);
49 (defpackage "PS-TEST.PSTSTPKG"
53 (setf (ps-package-prefix "PS-TEST.PSTSTPKG") "prefix_")
54 (is (string= "prefix_foo;" (normalize-js-code (ps* 'ps-test.pststpkg
::foo
)))))
56 (common-lisp:in-package
"PS-TEST.PSTSTPKG")
58 (ps-test::test-ps-js namespace-and-special-forms
59 (let ((foo (create bar
1 not-a-keyword something
)))
60 (return (and (not foo
) (+ (getprop foo
'bar
) some-other-var
))))
61 "var prefix_foo = { prefix_bar : 1, prefix_notAKeyword : prefix_something };
62 return !prefix_foo && prefix_foo.prefix_bar + prefix_someOtherVar;")