aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2020-12-14 20:47:05 -0500
committerMarshall Lochbaum <mwlochbaum@gmail.com>2020-12-14 20:47:05 -0500
commitd4e8cf5c90a2c5b6ed661e468842f34b631dbb44 (patch)
tree059ea10c25e449afb14591b0554068ed68b14fda
parent6c250d890add5f0fc09b94925ae528292642d8cb (diff)
Pass names of tests as options instead of using ad-hoc prim option
-rw-r--r--test/README.txt5
-rwxr-xr-xtest/dz_comp5
-rwxr-xr-xtest/js7
3 files changed, 11 insertions, 6 deletions
diff --git a/test/README.txt b/test/README.txt
index 66acffe7..22a601b4 100644
--- a/test/README.txt
+++ b/test/README.txt
@@ -13,7 +13,10 @@ Test cases (cases/):
js dz_comp dz_wasm.js
- simple.bqn * * *
- syntax.bqn * *
-- prim.bqn -prim -prim
+- prim.bqn *
+
+dz_comp can be run on a different set of tests by passing their names
+as arguments; for js the argument "--" is needed, then the names.
Contents of bin/dbqn follow (3 lines). Replace "/path/to/dzaima/" with
your path.
diff --git a/test/dz_comp b/test/dz_comp
index 4fee5da3..1909a150 100755
--- a/test/dz_comp
+++ b/test/dz_comp
@@ -1,6 +1,7 @@
#! /usr/bin/env dbqn
-nc‿rt‿prim ← "-nocomp"‿"-rt"‿"-prim" ∊ •args
+nc‿rt ← "-nocomp"‿"-rt" ∊ •args
+files ← "simple"‿"syntax"‿"prim"⍟(0=≠) ('-'≠⊑)¨⊸/ •args
"Can't test runtime without the compiler!" ! ¬nc∧rt
⟨DRun,DCompile⟩ ← •Import "../dc.bqn"
@@ -26,7 +27,7 @@ Native ← {⍎𝕩}
exec ← (rt¬nc)◶⟨Native˙, DRun˙, {𝕩⊸DRun}∘GetRT⟩ @
Cases ← (0<≠)◶0‿('#'≠⊑)¨⊸/ · •FLines "cases/"∾∾⟜".bqn"
-c ← ∾ Cases¨ "simple"‿"syntax"∾prim/⟨"prim"⟩
+c ← ∾ Cases¨ files
M ← {e‿b:
Err ← {(@+10)∾˜""""∾b∾""": expected "∾e∾" but received "∾⍕𝕩}
(Native e) ≢◶""‿Err Exec b
diff --git a/test/js b/test/js
index 6c312b38..0f09b0a9 100755
--- a/test/js
+++ b/test/js
@@ -6,10 +6,11 @@ let cases = f=>read(__dirname+'/cases/'+f+'.bqn','utf8').split('\n')
.filter(x=>x.length>0 && x.charAt(0)!=='#')
.map(x=>x.indexOf('%')===-1?[1,x]:x.split(' % '));
let args = process.argv.slice(2);
-let prim = args[0]==="-prim";
+let onfiles = args[0]==='--';
+let files = onfiles ? args.slice(1) : ['simple','syntax'];
-if (prim || args.length==0) {
- let t = [].concat(cases('simple'),cases('syntax'),prim?cases('prim'):[]);
+if (onfiles || args.length==0) {
+ let t = [].concat.apply([],files.map(cases));
let test = t.map(e=>e[1]);
let expt = t.map(e=>+e[0]);