Skip to content

Commit

Permalink
Fix for #14
Browse files Browse the repository at this point in the history
  • Loading branch information
aplteam committed Jun 5, 2024
1 parent 97ef63d commit 3320c55
Show file tree
Hide file tree
Showing 19 changed files with 7,264 additions and 37 deletions.
16 changes: 10 additions & 6 deletions APLSource/CodeCoverage.aplc
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,17 @@

rVersion
:Access Public Shared
r'CodeCoverage' '0.10.6+52' '2024-03-13'
r'CodeCoverage' '0.10.7+52' '2024-06-05'

History
:Access Public Shared
* 0.10.6 from 2024-01-30
* Neither `#` nor `⎕SE` were allowed
* 0.10.7 from 2024-06-05
* Bug fixes
* A comma-separated list as argument to ⎕NEW caused a LENGTH ERROR
* CodeCoverage tests attempted to act on itself - that cannot work properly because the tests overwrite ⎕PROFILE
* 0.10.6 from 2024-01-30
* Neither `#` nor `⎕SE` were allowed
* 0.10.5 from 2024-01-12
* Link to `Tester2` in the documentation corrected
* 0.10.4 from 2024-01-12
Expand Down Expand Up @@ -141,7 +145,7 @@
'Must be character vector'⎕SIGNAL 11/' '10v
('Has invalid characters',b/v)⎕SIGNAL 11//b~vAPL_Chars,',⎕#.'
v2','(),v
:If ~v2,¨'#' '⎕SE'
:If ~/v2,¨'#' '⎕SE'
:If /~b0<⎕NCv2
11 ⎕SIGNAL'Unknown names: ',{,',',}/(~b)/v2
:EndIf
Expand Down Expand Up @@ -419,7 +423,7 @@
again, for example.
:Access Public Instance
r
{Stop }(~∆STOPPED)
0 0{Stop }(~∆STOPPED)
_data_data[;1]{()(,/)}_data[;2]
namesCollectDataForCoverageReport _watch
details0 4
Expand Down Expand Up @@ -568,7 +572,7 @@
:If ⎕NEXISTS cr.filename
cr.tnocr.filename ⎕FTIE 0
cr.names⎕FREAD cr.tno,1
'tied ',cr.filename,' for listings'
'Tied ',cr.filename,' for listings'
:Else
'Did not find file "',cr.filename,'" with CRs collected by fn "Finalize" - will try to work without it'
cr.tno0
Expand Down
1 change: 1 addition & 0 deletions APLSource/TestCases/Assert.aplf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Assert{'' (,1),:r1 ⎕ML1 ⎕SIGNAL 1(),11}
37 changes: 21 additions & 16 deletions APLSource/TestCases/Prepare.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,29 @@
T⎕NEW Tester2 ⎕THIS
testPath##.CiderConfig.HOME,'/TestResults'
testFilenametestPath,'/CodeCoverage'
flag0
:If ⎕NEXISTS testPath
:If ⎕NEXISTS testFilename,'.profile'
ind('Code Coverage' 0 1)CommTools.Select'Append' 'Replace' 'Neither'
(3=ind)/0
flag1
:If 2=ind
1 CodeCoverage.DeleteFiles testFilename
:If 0
We cannot use CodeCoverage on its own test cases yet, because the tests would overwrite
⎕PROFILE data over and over again, leaving hardly anything useful at the end. For that to
work every single test case that is using ⎕PROIFLE data needs to be executed in its own
APL thread.
flag0
:If ⎕NEXISTS testPath
:If ⎕NEXISTS testFilename,'.profile'
ind('Code Coverage' 0 1)CommTools.Select'Append' 'Replace' 'Neither'
(3=ind)/0
flag1
:If 2=ind
1 CodeCoverage.DeleteFiles testFilename
:EndIf
:Else
flag0 CommTools.YesOrNo'Code coverage?'
:EndIf
:Else
flag0 CommTools.YesOrNo'Code coverage?'
:EndIf
:Else
flag0 CommTools.YesOrNo'Code coverage?'
:EndIf
:If flag
3 ⎕MKDIR testPath
TODO⍝ T.codeCoverage←⎕NEW CodeCoverage(,⊂'#.',{⍵,'.',⍵}2↓⍕⎕THIS.##)
T.codeCoverage⎕NEW ##.CodeCoverage(,'#')
T.codeCoverage.filenametestFilename
:If flag
3 ⎕MKDIR testPath
T.codeCoverage⎕NEW ##.CodeCoverage(,'#')
T.codeCoverage.filenametestFilename
:EndIf
:EndIf
2 changes: 1 addition & 1 deletion APLSource/TestCases/Test_Misc_002.aplf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
RTest_Misc_002(stopFlag batchFlag);⎕TRAP;htmlFilename;tno;result;toc;b;row;name;could;did
Just runs all sorts of functions and then checks the coverage results
Just runs stuff in a script and then checks the coverage results
⎕TRAP(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
RT._Failed

Expand Down
2 changes: 1 addition & 1 deletion APLSource/TestCases/Test_Misc_010.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
RT._OK

∆TidyUp:
1 T.codeCoverage.DeleteFiles C.filename
1 C.DeleteFiles C.filename
Data.⎕EX'T'
Done
35 changes: 35 additions & 0 deletions APLSource/TestCases/Test_Misc_021.aplf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
RTest_Misc_021(stopFlag batchFlag);⎕TRAP;htmlFilename;html;ref;C;body1;body2
Spcify comma-separated list to watch
⎕TRAP(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')

RT._Failed

#.⎕SHADOW'TEMP1' 'TEMP1'#.⎕NS''
#.⎕SHADOW'TEMP2' 'TEMP2'#.⎕NS''

body1':Namespace Foo' '∇r←Hello' 'r←''Hello world''' '→0' 'a←1' '' ':EndNamespace'
ref#.TEMP1.⎕FIX body1

body2':Namespace Goo' '∇r←Hello' 'r←''Hello galaxy''' '→0' 'b←1' '' ':EndNamespace'
ref#.TEMP2.⎕FIX body2

C⎕NEW ##.CodeCoverage(,'#.TEMP1,#.TEMP2')

C.Start
Assert'Hello world'#.TEMP1.Foo.Hello
Assert'Hello galaxy'#.TEMP2.Goo.Hello

C.Stop
{}C.Finalise
T.PassesIf 2=C.data
{}1 ##.CodeCoverage.ProcessDataAndCreateReport C.filename
html⎕NGET C.filename,'.html'
T.GoToTidyUp 0=+/'>→[3] 'html
T.GoToTidyUp 2'>→\[[0-9]+] '⎕S 0html

RT._OK

∆TidyUp:
1 C.DeleteFiles C.filename
Data.⎕EX'T'
Done
2 changes: 1 addition & 1 deletion APLSource/TestCases/Test_Misc_031.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@

∆TidyUp:
##.CodeCoverage.Info''
1 T.codeCoverage.DeleteFiles C.filename
1 C.DeleteFiles C.filename
Done
2 changes: 1 addition & 1 deletion APLSource/TestCases/Test_Misc_032.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@

∆TidyUp:
##.CodeCoverage.Info''
1 T.codeCoverage.DeleteFiles C.filename
1 C.DeleteFiles C.filename
Done
2 changes: 1 addition & 1 deletion APLSource/TestCases/Test_Misc_033.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
RT._OK

∆TidyUp:
1 T.codeCoverage.DeleteFiles C.filename
1 C.DeleteFiles C.filename
Done
2 changes: 1 addition & 1 deletion APLSource/TestCases/Test_Misc_040.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
RT._OK

∆TidyUp:
1 T.codeCoverage.DeleteFiles C.filename
1 C.DeleteFiles C.filename
Done
2 changes: 1 addition & 1 deletion APLSource/TestCases/Test_Misc_041.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@

∆TidyUp:
⎕FUNTIE tno
1 T.codeCoverage.DeleteFiles T2.codeCoverage.filename
1 T2.codeCoverage.DeleteFiles T2.codeCoverage.filename
Done
2 changes: 1 addition & 1 deletion APLSource/TestCases/Test_Misc_051.aplf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@

∆TidyUp:
⎕FUNTIE tno
1 T.codeCoverage.DeleteFiles Data.T.codeCoverage.filename
1 Data.T.codeCoverage.DeleteFiles Data.T.codeCoverage.filename
Data.⎕EX'T'
Done
4 changes: 2 additions & 2 deletions APLSource/TestCases/Test_Misc_061.aplf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
RTest_Misc_061(stopFlag batchFlag);⎕TRAP;htmlFilename;row;name;could;did;html
Calls ProcessData and CreateReport rather than ProcessDataAndCreateReport
Calls ProcessData and CreateReport rather than ProcessDataAndCreateReport and ignore a function
⎕TRAP(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
RT._Failed

Expand All @@ -16,6 +16,6 @@
RT._OK

∆TidyUp:
1 T.codeCoverage.DeleteFiles Data.T.codeCoverage.filename
1 Data.T.codeCoverage.DeleteFiles Data.T.codeCoverage.filename
Data.⎕EX'T'
Done
Binary file modified TestResults/CodeCoverage.cr
Binary file not shown.
Loading

0 comments on commit 3320c55

Please sign in to comment.