Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
parenscript
parenscript
Commits
b21e663d
Verified
Commit
b21e663d
authored
Oct 06, 2018
by
Vladimir Sedach
Browse files
Long, unambiguous names for test packages
parent
d784bf93
Changes
6
Hide whitespace changes
Inline
Side-by-side
parenscript.test.asd
→
parenscript.test
s
.asd
View file @
b21e663d
;;;; -*- lisp -*-
(
defsystem
:parenscript.test
(
defsystem
:parenscript.test
s
:license
"BSD-3-Clause"
:description
"Unit tests for Parenscript"
:components
((
:module
:tests
...
...
tests/eval-tests.lisp
View file @
b21e663d
;; SPDX-License-Identifier: BSD-3-Clause
(
in-package
#:p
s-
eval-tests
)
(
in-package
#:p
arenscript.
eval-tests
)
(
named-readtables:in-readtable
:parenscript
)
#+
sbcl
(
declaim
(
sb-ext:muffle-conditions
sb-ext:compiler-note
))
(
in-suite
p
s-
test::eval-tests
)
(
in-suite
p
arenscript.
test
s
::eval-tests
)
(
test-js-eval
number
3
...
...
tests/output-tests.lisp
View file @
b21e663d
;; SPDX-License-Identifier: BSD-3-Clause
(
in-package
#:p
s-
test
)
(
in-package
#:p
arenscript.
test
s
)
(
named-readtables:in-readtable
:parenscript
)
(
in-suite
output-tests
)
...
...
tests/package-system-tests.lisp
View file @
b21e663d
;; SPDX-License-Identifier: BSD-3-Clause
(
in-package
#:p
s-
test
)
(
in-package
#:p
arenscript.
test
s
)
(
in-suite
package-system-tests
)
...
...
@@ -8,20 +8,20 @@
(
#:new
)
"new();"
)
(
defpackage
#:p
s-
test.my-library
(
defpackage
#:p
arenscript.
test
s
.my-library
(
:use
#:parenscript
))
(
setf
(
ps-package-prefix
'
#:p
s-
test.my-library
)
"my_library_"
)
(
setf
(
ps-package-prefix
'
#:p
arenscript.
test
s
.my-library
)
"my_library_"
)
(
test-ps-js
lib-function1
(
defun
p
s-
test.my-library::library-function
(
x
y
)
(
defun
p
arenscript.
test
s
.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
p
s-
test.my-library::foo
1
)
(
getprop
foo
'p
s-
test.my-library::foo
))
(
progn
(
create
p
arenscript.
test
s
.my-library::foo
1
)
(
getprop
foo
'p
arenscript.
test
s
.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
#:p
s-
test.obfuscate-me
)
(
obfuscate-package
'
#:p
s-
test.obfuscate-me
#'
symbol-obfuscator
)
(
defpackage
#:p
arenscript.
test
s
.obfuscate-me
)
(
obfuscate-package
'
#:p
arenscript.
test
s
.obfuscate-me
#'
symbol-obfuscator
)
(
test-ps-js
obfuscation1
(
defun
p
s-
test.obfuscate-me::libfun2
(
a
b
p
s-
test.obfuscate-me::foo
)
(
+
a
(
p
s-
test.my-library::library-function
b
p
s-
test.obfuscate-me::foo
)))
(
defun
p
arenscript.
test
s
.obfuscate-me::libfun2
(
a
b
p
arenscript.
test
s
.obfuscate-me::foo
)
(
+
a
(
p
arenscript.
test
s
.my-library::library-function
b
p
arenscript.
test
s
.obfuscate-me::foo
)))
"function mjcgvo3(a, b, gpp) {
return a + my_library_libraryFunction(b, gpp);
};"
)
(
defpackage
#:p
s-
test.obfuscate-and-prefix
)
(
obfuscate-package
'
#:p
s-
test.obfuscate-and-prefix
#'
symbol-obfuscator
)
(
setf
(
ps-package-prefix
'
#:p
s-
test.obfuscate-and-prefix
)
"__FOO___"
)
(
defpackage
#:p
arenscript.
test
s
.obfuscate-and-prefix
)
(
obfuscate-package
'
#:p
arenscript.
test
s
.obfuscate-and-prefix
#'
symbol-obfuscator
)
(
setf
(
ps-package-prefix
'
#:p
arenscript.
test
s
.obfuscate-and-prefix
)
"__FOO___"
)
(
test-ps-js
obfuscate-and-prefix
(
defun
p
s-
test.obfuscate-and-prefix::xfun
(
a
p
s-
test.obfuscate-and-prefix::b
p
s-
test.my-library::d
)
(
defun
p
arenscript.
test
s
.obfuscate-and-prefix::xfun
(
a
p
arenscript.
test
s
.obfuscate-and-prefix::b
p
arenscript.
test
s
.my-library::d
)
(
*
a
(
p
s-
test.obfuscate-me::libfun2
p
s-
test.obfuscate-and-prefix::b
a
)
(
p
s-
test.my-library::library-function
p
s-
test.my-library::d
p
s-
test.obfuscate-and-prefix::b
)))
(
p
arenscript.
test
s
.obfuscate-me::libfun2
p
arenscript.
test
s
.obfuscate-and-prefix::b
a
)
(
p
arenscript.
test
s
.my-library::library-function
p
arenscript.
test
s
.my-library::d
p
arenscript.
test
s
.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
#:p
s-
test.pststpkg
(
defpackage
#:p
arenscript.
test
s
.pststpkg
(
:use
#:parenscript
))
(
setf
(
ps-package-prefix
'
#:p
s-
test.pststpkg
)
"prefix_"
)
(
setf
(
ps-package-prefix
'
#:p
arenscript.
test
s
.pststpkg
)
"prefix_"
)
(
test
namespace1
()
(
is
(
string=
"prefix_foo;"
(
normalize-js-code
(
ps*
'p
s-
test.pststpkg::foo
)))))
(
is
(
string=
"prefix_foo;"
(
normalize-js-code
(
ps*
'p
arenscript.
test
s
.pststpkg::foo
)))))
(
cl:in-package
#:p
s-
test.pststpkg
)
(
cl:in-package
#:p
arenscript.
test
s
.pststpkg
)
(
p
s-
test::test-ps-js
namespace-and-special-forms
(
p
arenscript.
test
s
::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;
};"
)
(
p
s-
test::test-ps-js
exported-interface
(
defun
p
s-
test:interface-function
(
baz
)
(
+
baz
p
s-
test.obfuscate-me::foo
))
(
p
arenscript.
test
s
::test-ps-js
exported-interface
(
defun
p
arenscript.
test
s
:interface-function
(
baz
)
(
+
baz
p
arenscript.
test
s
.obfuscate-me::foo
))
"function interfaceFunction(prefix_baz) {
return prefix_baz + gpp;
};"
)
(
cl:in-package
#:p
s-
test
)
(
cl:in-package
#:p
arenscript.
test
s
)
(
test
compile-stream-in-package
(
is
(
string=
...
...
@@ -93,14 +93,14 @@ function interfaceFunction(prefix_baz) {
};
"
(
with-input-from-string
(
s
"
(defun p
s-
test.obfuscate-and-prefix::xfun (a p
s-
test.obfuscate-and-prefix::b p
s-
test.my-library::d)
(defun p
arenscript.
test
s
.obfuscate-and-prefix::xfun (a p
arenscript.
test
s
.obfuscate-and-prefix::b p
arenscript.
test
s
.my-library::d)
(* a
(p
s-
test.obfuscate-me::libfun2 p
s-
test.obfuscate-and-prefix::b a)
(p
s-
test.my-library::library-function p
s-
test.my-library::d p
s-
test.obfuscate-and-prefix::b)))
(p
arenscript.
test
s
.obfuscate-me::libfun2 p
arenscript.
test
s
.obfuscate-and-prefix::b a)
(p
arenscript.
test
s
.my-library::library-function p
arenscript.
test
s
.my-library::d p
arenscript.
test
s
.obfuscate-and-prefix::b)))
(in-package #:p
s-
test.pststpkg)
(in-package #:p
arenscript.
test
s
.pststpkg)
(defun p
s-
test:interface-function (baz)
(+ baz p
s-
test.obfuscate-me::foo))
(defun p
arenscript.
test
s
:interface-function (baz)
(+ baz p
arenscript.
test
s
.obfuscate-me::foo))
"
)
(
ps-compile-stream
s
)))))
tests/test-package.lisp
View file @
b21e663d
(
in-package
#:cl
)
(
named-readtables:in-readtable
:parenscript
)
(
defpackage
#:p
s-
test
(
defpackage
#:p
arenscript.
test
s
(
: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
#:p
s-
eval-tests
(
:use
#:cl
#:eos
#:parenscript
#:p
s-
test
))
(
defpackage
#:p
arenscript.
eval-tests
(
:use
#:cl
#:eos
#:parenscript
#:p
arenscript.
test
s
))
tests/test.lisp
View file @
b21e663d
;; SPDX-License-Identifier: BSD-3-Clause
(
in-package
#:p
s-
test
)
(
in-package
#:p
arenscript.
test
s
)
(
defun
normalize-whitespace
(
str
)
(
substitute
#\Space
#\Newline
(
substitute
#\Space
#\Tab
str
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment