From c67afd6e523573e79ab1537b582cf1bdec51d187 Mon Sep 17 00:00:00 2001 From: dzaima Date: Sun, 1 Jun 2025 05:54:33 +0300 Subject: [PATCH] =?UTF-8?q?add=20a=20way=20to=20allow=20=E2=8E=8A-ful=20te?= =?UTF-8?q?sts=20to=20run=20in=20noerr=20mode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/README.md | 1 + test/run.bqn | 15 +++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/README.md b/test/README.md index 7f5a7faa..0a838834 100644 --- a/test/README.md +++ b/test/README.md @@ -45,6 +45,7 @@ tests: %SLOW # enable only if 'slow' argument present %!DEBUG # disable if 'debug' 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==1 ``` \ No newline at end of file diff --git a/test/run.bqn b/test/run.bqn index 814f58b5..b93f7eca 100644 --- a/test/run.bqn +++ b/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.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∧↩ ¬ o.noerr ∧ (⊑'⎊'∊str) ∧ ¬Flag "%ALLOW_CATCH" ln ⇐ i-1 str ⇐ str # at end to let Flag have updated it @@ -157,7 +158,6 @@ Run ← { 𝕊 testname: badCount ← 0 badMessage ← 0 currLn ← 0 - skipped ← 0 dir ← •file.At "testDir" •file.CreateDir⍟(¬•file.Exists) dir Bad ← { @@ -178,16 +178,16 @@ Run ← { 𝕊 testname: ⟨dir, ∾⟨testname,"_line_",•Repr currLn+1,".bqn"⟩, ⟨helpers,"arg0",1⟩⟩ •BQN 𝕩 } EvalS ← •BQN⎊{𝕊: Bad "Computing expected value errored" ⋄ "(could not compute expected value)"} + toRun ← tests toRun {{𝕩.enabled}∘⊑¨⊸/𝕩}↩ - skipped+↩ (≠tests)-≠toRun + skipped ← (≠tests)-≠toRun results ← { - "eval"‿str: { - o.noerr? ⊑'⎊'∊str? skipped+↩1; + ns‿"eval"‿str: { Eval _catch_ {𝕊: Bad "Expected success, got error: "∾ErrMsg@} str @ }; - "error"‿str‿exp: { + ·‿"error"‿str‿exp: { o.noerr? skipped+↩1; ok‿got ← (1⋈Eval)⎊(0⋈ErrMsg) str exp ↩ EvalS⍟{×≠Trim𝕩} exp @@ -199,8 +199,7 @@ Run ← { 𝕊 testname: got } }; - "equal"‿str‿exp: { - o.noerr? ⊑'⎊'∊str? skipped+↩1; + ns‿"equal"‿str‿exp: { ok‿got ← (1⋈Eval)_catch_(0⋈ErrMsg) str 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