add a way to allow ⎊-ful tests to run in noerr mode
This commit is contained in:
parent
5d7caab374
commit
c67afd6e52
@ -45,6 +45,7 @@ tests:
|
|||||||
%SLOW # enable only if 'slow' argument present
|
%SLOW # enable only if 'slow' argument present
|
||||||
%!DEBUG # disable if 'debug' argument present
|
%!DEBUG # disable if 'debug' argument present
|
||||||
%!HEAPVERIFY # disable if 'heapverify' argument present
|
%!HEAPVERIFY # disable if 'heapverify' argument present
|
||||||
|
%ALLOW_CATCH # allow running in noerr mode even if ⎊ is present
|
||||||
%!PROPER_FILLS # enable only if has PROPER_FILLS==0
|
%!PROPER_FILLS # enable only if has PROPER_FILLS==0
|
||||||
%PROPER_FILLS # enable only if has PROPER_FILLS==1
|
%PROPER_FILLS # enable only if has PROPER_FILLS==1
|
||||||
```
|
```
|
||||||
15
test/run.bqn
15
test/run.bqn
@ -124,6 +124,7 @@ Run ← { 𝕊 testname:
|
|||||||
enabled∧↩ {0‿0: 1; 1‿0: o.eachFills ; 0‿1: ¬o.eachFills } Flag¨ "%EACH_FILLS"‿"%!EACH_FILLS"
|
enabled∧↩ {0‿0: 1; 1‿0: o.eachFills ; 0‿1: ¬o.eachFills } Flag¨ "%EACH_FILLS"‿"%!EACH_FILLS"
|
||||||
enabled∧↩ {0‿0: 1; 1‿0: o.usz=32; 0‿1: o.usz=64} Flag¨ "%USZ32"‿"%USZ64"
|
enabled∧↩ {0‿0: 1; 1‿0: o.usz=32; 0‿1: o.usz=64} Flag¨ "%USZ32"‿"%USZ64"
|
||||||
enabled∧↩ {0‿0: 1; 1‿0: o.usz=32; 0‿1: o.usz=64} Flag¨ "%USZ32"‿"%EACHFILLS"
|
enabled∧↩ {0‿0: 1; 1‿0: o.usz=32; 0‿1: o.usz=64} Flag¨ "%USZ32"‿"%EACHFILLS"
|
||||||
|
enabled∧↩ ¬ o.noerr ∧ (⊑'⎊'∊str) ∧ ¬Flag "%ALLOW_CATCH"
|
||||||
|
|
||||||
ln ⇐ i-1
|
ln ⇐ i-1
|
||||||
str ⇐ str # at end to let Flag have updated it
|
str ⇐ str # at end to let Flag have updated it
|
||||||
@ -157,7 +158,6 @@ Run ← { 𝕊 testname:
|
|||||||
badCount ← 0
|
badCount ← 0
|
||||||
badMessage ← 0
|
badMessage ← 0
|
||||||
currLn ← 0
|
currLn ← 0
|
||||||
skipped ← 0
|
|
||||||
dir ← •file.At "testDir"
|
dir ← •file.At "testDir"
|
||||||
•file.CreateDir⍟(¬•file.Exists) dir
|
•file.CreateDir⍟(¬•file.Exists) dir
|
||||||
Bad ← {
|
Bad ← {
|
||||||
@ -178,16 +178,16 @@ Run ← { 𝕊 testname:
|
|||||||
⟨dir, ∾⟨testname,"_line_",•Repr currLn+1,".bqn"⟩, ⟨helpers,"arg0",1⟩⟩ •BQN 𝕩
|
⟨dir, ∾⟨testname,"_line_",•Repr currLn+1,".bqn"⟩, ⟨helpers,"arg0",1⟩⟩ •BQN 𝕩
|
||||||
}
|
}
|
||||||
EvalS ← •BQN⎊{𝕊: Bad "Computing expected value errored" ⋄ "(could not compute expected value)"}
|
EvalS ← •BQN⎊{𝕊: Bad "Computing expected value errored" ⋄ "(could not compute expected value)"}
|
||||||
|
|
||||||
toRun ← tests
|
toRun ← tests
|
||||||
toRun {{𝕩.enabled}∘⊑¨⊸/𝕩}↩
|
toRun {{𝕩.enabled}∘⊑¨⊸/𝕩}↩
|
||||||
skipped+↩ (≠tests)-≠toRun
|
skipped ← (≠tests)-≠toRun
|
||||||
results ← {
|
results ← {
|
||||||
"eval"‿str: {
|
ns‿"eval"‿str: {
|
||||||
o.noerr? ⊑'⎊'∊str? skipped+↩1;
|
|
||||||
Eval _catch_ {𝕊: Bad "Expected success, got error: "∾ErrMsg@} str
|
Eval _catch_ {𝕊: Bad "Expected success, got error: "∾ErrMsg@} str
|
||||||
@
|
@
|
||||||
};
|
};
|
||||||
"error"‿str‿exp: {
|
·‿"error"‿str‿exp: {
|
||||||
o.noerr? skipped+↩1;
|
o.noerr? skipped+↩1;
|
||||||
ok‿got ← (1⋈Eval)⎊(0⋈ErrMsg) str
|
ok‿got ← (1⋈Eval)⎊(0⋈ErrMsg) str
|
||||||
exp ↩ EvalS⍟{×≠Trim𝕩} exp
|
exp ↩ EvalS⍟{×≠Trim𝕩} exp
|
||||||
@ -199,8 +199,7 @@ Run ← { 𝕊 testname:
|
|||||||
got
|
got
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
"equal"‿str‿exp: {
|
ns‿"equal"‿str‿exp: {
|
||||||
o.noerr? ⊑'⎊'∊str? skipped+↩1;
|
|
||||||
ok‿got ← (1⋈Eval)_catch_(0⋈ErrMsg) str
|
ok‿got ← (1⋈Eval)_catch_(0⋈ErrMsg) str
|
||||||
exp ↩ EvalS exp
|
exp ↩ EvalS exp
|
||||||
{
|
{
|
||||||
@ -211,7 +210,7 @@ Run ← { 𝕊 testname:
|
|||||||
}
|
}
|
||||||
@
|
@
|
||||||
}
|
}
|
||||||
}∘{currLn↩(⊑𝕩).ln ⋄ 1↓𝕩}¨ toRun
|
}∘{currLn↩(⊑𝕩).ln ⋄ 𝕩}¨ toRun
|
||||||
|
|
||||||
{𝕊:
|
{𝕊:
|
||||||
res‿desc ← ({@≡𝕩? 0; (¬⊑(@+10)∊𝕩) ∧ ¬∨´"TEST FAIL"⍷𝕩}¨ results)⊸/¨ results‿toRun
|
res‿desc ← ({@≡𝕩? 0; (¬⊑(@+10)∊𝕩) ∧ ¬∨´"TEST FAIL"⍷𝕩}¨ results)⊸/¨ results‿toRun
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user