From d4e8cf5c90a2c5b6ed661e468842f34b631dbb44 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Mon, 14 Dec 2020 20:47:05 -0500 Subject: Pass names of tests as options instead of using ad-hoc prim option --- test/README.txt | 5 ++++- test/dz_comp | 5 +++-- test/js | 7 ++++--- 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]); -- cgit v1.2.3