summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Werkmeister2021-07-31 16:19:44 +0200
committerLucas Werkmeister2021-07-31 16:19:44 +0200
commit56986527709ca30d38ba000083492ec6f686af73 (patch)
tree3cd71b6ff4289ae5cf69954df0ca4e30c2dfed4e
parenta3b36b6f74b86f4e7157c09d7d5297cd46ccd320 (diff)
downloadaur-56986527709ca30d38ba000083492ec6f686af73.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-xtest.sh25
1 files changed, 12 insertions, 13 deletions
diff --git a/test.sh b/test.sh
index 6ebaae3ef1ac..0b6209c3adcf 100755
--- a/test.sh
+++ b/test.sh
@@ -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