Skip to content

Commit 3d5240e

Browse files
committed
Assigning a custom return code could crash <Tester2.ReportTestResults>
1 parent c8f2c94 commit 3d5240e

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
r←Test_Misc_08(debugFlag batchFlag);⎕TRAP;A;tmp;rc;log
2+
⍝ Exercise the `RunThese` method with a custom return code
3+
⎕TRAP←(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
4+
r←T._Failed
5+
6+
A←APLTreeUtils2
7+
8+
⍝ Pre-conditions
9+
tmp←⎕NS''
10+
tmp.⎕FX'r←Test_001 (x y);⎕TRAP' ' ⍝ This and that' 'r←0'
11+
tmp.T←⎕NEW ##.Tester2 tmp
12+
tmp.T.custom_1←'Nested scripts are not supported'
13+
14+
⍝ The test
15+
(rc log)←tmp.T.RunThese 1
16+
→T.FailsIf rc≠0
17+
18+
r←T._OK

APLSource/Tester2.aplc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
⍝ * `Prepare` does not ask for code coverage reports when the CodeCoverage class is not around
5353
⍝ * The documentation did not embedd the CSS
5454
⍝ * Some minor issues fixed in the documentation
55+
⍝ * Assigning a custom return code could crash `Tester2.ReportTestResults`
5556
⍝ * 4.0.0 ⋄ 2025-04-03
5657
⍝ * Potenially breaking change: `Version` now returns the package config version number as a char vector
5758
⍝ * Packages updated
@@ -950,7 +951,7 @@
950951
:AndIf 0<≢comment
951952
:AndIf 0<noOf←ps.returnCodes+.=-⊃(//)⎕VFI(≢'_custom_')↓constant
952953
log,←⊂' ',(⍕noOf),' test cases not executed because of "',comment,'" (flagged with "⍝")'
953-
:ElseIf 0<noOf←ps.returnCodes+.=⍎constant
954+
:ElseIf 0<noOf←+/ps.returnCodes⍎constant
954955
log,←⊂' ',(⍕noOf),' test cases not executed because of "',(1↓constant),'" (flagged with "⍝")'
955956
:EndIf
956957
:EndFor

TestResults/CodeCoverage.cr

192 Bytes
Binary file not shown.

TestResults/CodeCoverage.profile

-8 Bytes
Binary file not shown.

apl-package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
source: "APLSource/Tester2.aplc",
2020
tags: "test,test-framework",
2121
userCommandScript: "",
22-
version: "4.1.0-beta-2+59",
22+
version: "4.1.0+61",
2323
}

0 commit comments

Comments
 (0)