diff options
author | Lucas Werkmeister | 2021-07-31 16:22:14 +0200 |
---|---|---|
committer | Lucas Werkmeister | 2021-07-31 16:22:14 +0200 |
commit | 91b3f5c58e20272551592c60b65850cca7c8f6dc (patch) | |
tree | c785828415a62485a17ccc88093b1fdb0874db3e | |
parent | 00071ae70f9356e85f3217f05d5bfdaf384cddde (diff) | |
download | aur-91b3f5c58e20272551592c60b65850cca7c8f6dc.tar.gz |
Use Node.js launcher in test.sh
The Node.js component is no longer included in this package, making it
separate from the JS language (which is still included), so we should
make sure to test it in test.sh. The simplest way to do that is to
replace R with Node as the host language for the polyglot test.
-rwxr-xr-x | test.sh | 25 |
1 files changed, 12 insertions, 13 deletions
@@ -13,20 +13,19 @@ function cleanup { trap cleanup EXIT PATH=/usr/lib/jvm/java-${java_}-graalvm/bin/:$(systemd-path search-binaries-default) -printf '%s\n' 'Testing polyglot R, JavaScript, Python, Ruby, and Java...' - -cat > test.R << 'EOF' -jsPlus = eval.polyglot('js', '(function(s1, s2) { return s1 + s2; })') -pythonPlus = eval.polyglot('python', 'lambda s1, s2: s1 + s2') -rubyOne = eval.polyglot('ruby', '1') -pythonOne = eval.polyglot('python', '1') -rOne = 1 -jvmPrint = java.type("java.lang.System")$out$println -jvmPrint(pythonPlus(jsPlus(rubyOne, pythonOne), rOne)) +printf '%s\n' 'Testing Node with polyglot R, Python, Ruby, JavaScript, and Java...' + +jsThree=$(node --polyglot << 'EOF' +rPlus = Polyglot.eval('R', '(function(s1, s2) s1 + s2)'); +pythonPlus = Polyglot.eval('python', 'lambda s1, s2: s1 + s2'); +rubyOne = Polyglot.eval('ruby', '1') +pythonOne = Polyglot.eval('python', '1') +jsOne = 1 +jvmPrint = Java.type('java.lang.System').out.println +jvmPrint(pythonPlus(rPlus(rubyOne, pythonOne), jsOne)) EOF - -rThree=$(Rscript --polyglot --jvm test.R) || exit -if [[ $rThree != 3 ]]; then +) || exit +if [[ $jsThree != 3 ]]; then printf 'expected 3, got %q\n' "$rThree" exit 1 fi |