|
1 | | - Prepare;testPath;testFilename;ask;answer |
| 1 | + Prepare;testPath;testFilename;ask;answer;options;flag;ind |
| 2 | +⍝ Creates an instance of the class `Tester2` named `T` and configures it for |
| 3 | +⍝ Assumes that the project is handled by the project manager "Cider", and that there is |
| 4 | +⍝ a namespace ##.CiderConfig available with the Cider config parameters. |
| 5 | +⍝ As a side effect is creates a folder "TestResults" in the project's root folder if the |
| 6 | +⍝ user wants to do code coverage with the `CodeCoverage` class. |
2 | 7 | ⎕IO←1 ⋄ ⎕ML←1 |
3 | 8 | T←⎕NEW Tester2 ⎕THIS |
4 | | - testPath←(⊃1 ⎕NPARTS''),'TestResults' |
| 9 | + testPath←##.CiderConfig.HOME,'/TestResults' |
5 | 10 | testFilename←testPath,'/CodeCoverage' |
| 11 | + flag←0 |
6 | 12 | :If ⎕NEXISTS testPath |
7 | | - :If ⎕NEXISTS testFilename,'.dcf' |
8 | | - ask←{⎕←⍵,'; 1=append, 2=replace' ⋄ a←⎕ ⋄ ~(⊂a)∊1 2:∇ ⍵ ⋄ ⊃a} |
9 | | - answer←⊃ask'Coverage file already exists' |
10 | | - :If 2≡answer |
11 | | - 1 ⎕NDELETE testFilename,'.dcf' |
| 13 | + :If ⎕NEXISTS testFilename,'.profile' |
| 14 | + ind←('Code Coverage' 0 1)CommTools.Select'Append' 'Replace' 'Neither' |
| 15 | + →(3=ind)/0 |
| 16 | + flag←1 |
| 17 | + :If 2=ind |
| 18 | + 1 CodeCoverage.DeleteFiles testFilename |
12 | 19 | :EndIf |
| 20 | + :Else |
| 21 | + flag←0 CommTools.YesOrNo'Code coverage?' |
13 | 22 | :EndIf |
| 23 | + :Else |
| 24 | + flag←0 CommTools.YesOrNo'Code coverage?' |
| 25 | + :EndIf |
| 26 | + :If flag |
| 27 | + 3 ⎕MKDIR testPath ⍝ |
| 28 | + T.codeCoverage←⎕NEW CodeCoverage(,⊂'#.',{⍵,'.',⍵}2↓⍕⎕THIS.##) |
| 29 | + T.codeCoverage.filename←testFilename |
14 | 30 | :EndIf |
15 | | - 3 ⎕MKDIR testPath ⍝ |
16 | | - T.codeCoverage←⎕NEW CodeCoverage(,⊂'#.',{⍵,'.',⍵}2↓⍕⎕THIS.##) |
17 | | - T.codeCoverage.filename←testFilename |
18 | | -⍝Done |
|
0 commit comments