Skip to content

Commit c3f167e

Browse files
committed
When a ref to a namespace (class) was passed as argument to ⎕NEW <CoderCoverage> reported 0 coverage
1 parent 1bb5144 commit c3f167e

File tree

5 files changed

+48
-7
lines changed

5 files changed

+48
-7
lines changed

APLSource/CodeCoverage.aplc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767

6868
∇ History
6969
:Access Public Shared
70+
⍝ * 0.11.1 from 2025-06-04
71+
⍝ * When a reference to a namespace or class was passed as argument to `⎕NEW`, `CoderCoverage` reported zero code coverage.
7072
⍝ * 0.11.0 from 2025-06-03
7173
⍝ * New method `ProcessDataAndCreateSummary` introduced
7274
⍝ * Several tests added
@@ -156,6 +158,7 @@
156158
'Must be character vector'⎕SIGNAL 11/⍨' '≠1↑0⍴v
157159
('Has invalid characters',b/v)⎕SIGNAL 11/⍨∨/b←~v∊APL_Chars,',⎕#.'
158160
v2←','(≠⊆⊢),v
161+
v2←{(,'#')≡,⍵:⍵ ⋄ '⎕SE'≡⍵:⍵ ⋄ ~9.1 9.2∊⍨⎕NC⊂⍵:⍵ ⋄ ⍵≡ref←⍎⍵:w ⋄ ⍕ref}¨v2 ⍝ Convert any refs to their targets
159162
:If ~∧/v2∊,¨'#' '⎕SE'
160163
:If ∨/~b←0<⎕NC↑v2
161164
11 ⎕SIGNAL⍨'Unknown names: ',⊃{⍺,',',⍵}/(~b)/v2
@@ -371,7 +374,7 @@
371374
:EndIf
372375
html,←⊂'<div id="footer">'
373376
html,←⊂'<hr>'
374-
html,←⊂'<p>Created by "CodeCoverage" version ',(2⊃Version),' from ',(3⊃Version),'</p>'
377+
html,←⊂'<p>Created by "CodeCoverage" version ',(Version),'</p>'
375378
html,←⊂'</div>'
376379
html,←⊂''
377380
html,←⊂'</body>'
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
R←Test_Misc_091(stopFlag batchFlag);⎕TRAP;filename;body;ref;ref2;C;html;htmlFilename
2+
⍝ Pass a ref poinnting to a package; was once a bug.
3+
⎕TRAP←(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
4+
5+
R←T._Failed
6+
7+
filename←(739⌶0),'/CodeCoverage_Tests/',⊃⎕SI
8+
3 ⎕MKDIR⊃⎕NPARTS filename
9+
10+
#.⎕SHADOW'TEMP'
11+
'TEMP'#.⎕NS''
12+
#.TEMP2←#.TEMP
13+
14+
body←,¨':Class Foo' '_Goo←⍬' ':Property Goo' ':Access Public Instance' '∇r←get' 'r←_Goo' '∇' '∇set arg' '_Goo←arg.NewValue' '∇' ':EndProperty' ':EndClass'
15+
ref←#.TEMP.⎕FIX body
16+
ref2←⎕NEW ref
17+
18+
C←⎕NEW ##.CodeCoverage(,⊂'#.TEMP2')
19+
C.filename←filename
20+
C.Start ⍬
21+
ref2.Goo←'Hello world'
22+
{}ref2.Goo
23+
C.Stop ⍬
24+
{}C.Finalise ⍬
25+
→T.GoToTidyUp 2≠≢C.data
26+
27+
htmlFilename←1 ##.CodeCoverage.ProcessDataAndCreateReport C.filename
28+
html←⊃⎕NGET htmlFilename
29+
→T.GoToTidyUp~∨/'Overall 100% of the testable code is covered.'⍷∊html
30+
31+
R←T._OK
32+
33+
∆TidyUp:
34+
1 C.DeleteFiles C.filename
35+
Data.⎕EX'T'
36+
#.⎕EX'TEMP2'
37+
{}FilesAndDirs.RmDirByForce⊃⎕NPARTS C.filename
38+
⍝Done

apl-package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
source: "APLSource/CodeCoverage.aplc",
2020
tags: "code-coverage,test-framework,unit-tests",
2121
userCommandScript: "",
22-
version: "0.11.0+69",
22+
version: "0.11.1+74",
2323
}

packages_dev/apl-buildlist.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
packageID: [
3-
"aplteam-Tester2-4.1.0",
3+
"aplteam-Tester2-4.2.0",
44
"aplteam-FilesAndDirs-7.0.0",
55
"aplteam-CommTools-2.0.1",
6-
"aplteam-CodeCoverage-0.11.0",
6+
"aplteam-CodeCoverage-0.11.1-beta-2",
77
"aplteam-APLTreeUtils2-1.4.1",
88
"aplteam-OS-4.0.0",
99
"aplteam-IniFiles-6.0.0",
@@ -21,7 +21,7 @@
2121
"https://tatin.dev/",
2222
"https://tatin.dev/",
2323
"https://tatin.dev/",
24-
"https://tatin.dev/",
24+
"http://localhost:444/",
2525
"https://tatin.dev/",
2626
"https://tatin.dev/",
2727
"https://tatin.dev/",

packages_dev/apl-dependencies.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
aplteam-APLTreeUtils2-1.4.1
2-
aplteam-Tester2-4.1.0
2+
aplteam-Tester2-4.2.0
33
aplteam-CommTools-2.0.1
4-
aplteam-CodeCoverage-0.11.0
4+
aplteam-CodeCoverage-0.11.1-beta-2
55
aplteam-FilesAndDirs-7.0.0

0 commit comments

Comments
 (0)