Verified Commit b21e663d authored by Vladimir Sedach's avatar Vladimir Sedach
Browse files

Long, unambiguous names for test packages

parent d784bf93
;;;; -*- lisp -*-
(defsystem :parenscript.test
(defsystem :parenscript.tests
:license "BSD-3-Clause"
:description "Unit tests for Parenscript"
:components ((:module :tests
......
;; SPDX-License-Identifier: BSD-3-Clause
(in-package #:ps-eval-tests)
(in-package #:parenscript.eval-tests)
(named-readtables:in-readtable :parenscript)
#+sbcl (declaim (sb-ext:muffle-conditions sb-ext:compiler-note))
(in-suite ps-test::eval-tests)
(in-suite parenscript.tests::eval-tests)
(test-js-eval number
3
......
;; SPDX-License-Identifier: BSD-3-Clause
(in-package #:ps-test)
(in-package #:parenscript.tests)
(named-readtables:in-readtable :parenscript)
(in-suite output-tests)
......
;; SPDX-License-Identifier: BSD-3-Clause
(in-package #:ps-test)
(in-package #:parenscript.tests)
(in-suite package-system-tests)
......@@ -8,20 +8,20 @@
(#:new)
"new();")
(defpackage #:ps-test.my-library
(defpackage #:parenscript.tests.my-library
(:use #:parenscript))
(setf (ps-package-prefix '#:ps-test.my-library) "my_library_")
(setf (ps-package-prefix '#:parenscript.tests.my-library) "my_library_")
(test-ps-js lib-function1
(defun ps-test.my-library::library-function (x y)
(defun parenscript.tests.my-library::library-function (x y)
(+ x y))
"function my_library_libraryFunction(x, y) {
return x + y;
};")
(test-ps-js uniform-symbol-handling1
(progn (create ps-test.my-library::foo 1)
(getprop foo 'ps-test.my-library::foo))
(progn (create parenscript.tests.my-library::foo 1)
(getprop foo 'parenscript.tests.my-library::foo))
"({ my_library_foo : 1 });
foo.my_library_foo;")
......@@ -32,40 +32,40 @@ foo.my_library_foo;")
(code-char (1+ (char-code x))))
(symbol-name symbol)))))))
(defpackage #:ps-test.obfuscate-me)
(obfuscate-package '#:ps-test.obfuscate-me #'symbol-obfuscator)
(defpackage #:parenscript.tests.obfuscate-me)
(obfuscate-package '#:parenscript.tests.obfuscate-me #'symbol-obfuscator)
(test-ps-js obfuscation1
(defun ps-test.obfuscate-me::libfun2 (a b ps-test.obfuscate-me::foo)
(+ a (ps-test.my-library::library-function b ps-test.obfuscate-me::foo)))
(defun parenscript.tests.obfuscate-me::libfun2 (a b parenscript.tests.obfuscate-me::foo)
(+ a (parenscript.tests.my-library::library-function b parenscript.tests.obfuscate-me::foo)))
"function mjcgvo3(a, b, gpp) {
return a + my_library_libraryFunction(b, gpp);
};")
(defpackage #:ps-test.obfuscate-and-prefix)
(obfuscate-package '#:ps-test.obfuscate-and-prefix #'symbol-obfuscator)
(setf (ps-package-prefix '#:ps-test.obfuscate-and-prefix) "__FOO___")
(defpackage #:parenscript.tests.obfuscate-and-prefix)
(obfuscate-package '#:parenscript.tests.obfuscate-and-prefix #'symbol-obfuscator)
(setf (ps-package-prefix '#:parenscript.tests.obfuscate-and-prefix) "__FOO___")
(test-ps-js obfuscate-and-prefix
(defun ps-test.obfuscate-and-prefix::xfun (a ps-test.obfuscate-and-prefix::b ps-test.my-library::d)
(defun parenscript.tests.obfuscate-and-prefix::xfun (a parenscript.tests.obfuscate-and-prefix::b parenscript.tests.my-library::d)
(* a
(ps-test.obfuscate-me::libfun2 ps-test.obfuscate-and-prefix::b a)
(ps-test.my-library::library-function ps-test.my-library::d ps-test.obfuscate-and-prefix::b)))
(parenscript.tests.obfuscate-me::libfun2 parenscript.tests.obfuscate-and-prefix::b a)
(parenscript.tests.my-library::library-function parenscript.tests.my-library::d parenscript.tests.obfuscate-and-prefix::b)))
"function __FOO___ygvo(a, __FOO___c, my_library_d) {
return a * mjcgvo3(__FOO___c, a) * my_library_libraryFunction(my_library_d, __FOO___c);
};")
(defpackage #:ps-test.pststpkg
(defpackage #:parenscript.tests.pststpkg
(:use #:parenscript))
(setf (ps-package-prefix '#:ps-test.pststpkg) "prefix_")
(setf (ps-package-prefix '#:parenscript.tests.pststpkg) "prefix_")
(test namespace1 ()
(is (string= "prefix_foo;" (normalize-js-code (ps* 'ps-test.pststpkg::foo)))))
(is (string= "prefix_foo;" (normalize-js-code (ps* 'parenscript.tests.pststpkg::foo)))))
(cl:in-package #:ps-test.pststpkg)
(cl:in-package #:parenscript.tests.pststpkg)
(ps-test::test-ps-js namespace-and-special-forms
(parenscript.tests::test-ps-js namespace-and-special-forms
(defun foo ()
(let ((foo (create bar 1 not-a-keyword something)))
(return-from foo (and (not foo) (+ (getprop foo 'bar) some-other-var)))))
......@@ -74,14 +74,14 @@ var foo1 = { prefix_bar : 1, prefix_notAKeyword : prefix_something };
return !foo1 && foo1.prefix_bar + prefix_someOtherVar;
};")
(ps-test::test-ps-js exported-interface
(defun ps-test:interface-function (baz)
(+ baz ps-test.obfuscate-me::foo))
(parenscript.tests::test-ps-js exported-interface
(defun parenscript.tests:interface-function (baz)
(+ baz parenscript.tests.obfuscate-me::foo))
"function interfaceFunction(prefix_baz) {
return prefix_baz + gpp;
};")
(cl:in-package #:ps-test)
(cl:in-package #:parenscript.tests)
(test compile-stream-in-package
(is (string=
......@@ -93,14 +93,14 @@ function interfaceFunction(prefix_baz) {
};
"
(with-input-from-string (s "
(defun ps-test.obfuscate-and-prefix::xfun (a ps-test.obfuscate-and-prefix::b ps-test.my-library::d)
(defun parenscript.tests.obfuscate-and-prefix::xfun (a parenscript.tests.obfuscate-and-prefix::b parenscript.tests.my-library::d)
(* a
(ps-test.obfuscate-me::libfun2 ps-test.obfuscate-and-prefix::b a)
(ps-test.my-library::library-function ps-test.my-library::d ps-test.obfuscate-and-prefix::b)))
(parenscript.tests.obfuscate-me::libfun2 parenscript.tests.obfuscate-and-prefix::b a)
(parenscript.tests.my-library::library-function parenscript.tests.my-library::d parenscript.tests.obfuscate-and-prefix::b)))
(in-package #:ps-test.pststpkg)
(in-package #:parenscript.tests.pststpkg)
(defun ps-test:interface-function (baz)
(+ baz ps-test.obfuscate-me::foo))
(defun parenscript.tests:interface-function (baz)
(+ baz parenscript.tests.obfuscate-me::foo))
")
(ps-compile-stream s)))))
(in-package #:cl)
(named-readtables:in-readtable :parenscript)
(defpackage #:ps-test
(defpackage #:parenscript.tests
(:use #:cl #:parenscript #:eos)
(:export #:parenscript-tests #:run-tests #:interface-function #:test-js-eval #:test-js-eval-epsilon #:jsarray))
(:export
#:parenscript-tests
#:run-tests
#:interface-function
#:test-js-eval
#:test-js-eval-epsilon
#:jsarray))
(defpackage #:ps-eval-tests
(:use #:cl #:eos #:parenscript #:ps-test))
(defpackage #:parenscript.eval-tests
(:use #:cl #:eos #:parenscript #:parenscript.tests))
;; SPDX-License-Identifier: BSD-3-Clause
(in-package #:ps-test)
(in-package #:parenscript.tests)
(defun normalize-whitespace (str)
(substitute #\Space #\Newline (substitute #\Space #\Tab str)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment