Skip to content

Commit 07465aa

Browse files
committed
<Cleanup> syntax enhanced and tests added
1 parent b9a9ff0 commit 07465aa

25 files changed

+313
-22
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
r←Test_Cleanup_01(debugFlag batchFlag);⎕TRAP;T2;rc;log;expected
2+
⍝ Exercise `Run` with a `Cleanup` function that returns a result indicating success
3+
⎕TRAP←(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
4+
r←T._Failed
5+
6+
#.⎕SHADOW'Temp'
7+
'Temp'#.⎕NS''
8+
T2←⎕NEW ##.Tester2 #.Temp
9+
#.Temp.⎕FX'r←Test_01 x;⎕TRAP' 'r←0'
10+
#.Temp.⎕FX'r←Cleanup' 'r←1'
11+
(rc log)←T2.Run 1
12+
→T.PassesIf 0=rc
13+
expected←'Looking for a function "Cleanup": found and executed successfully'
14+
→T.PassesIf ∨/expected⍷∊log
15+
16+
r←T._OK
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
r←Test_Cleanup_02(debugFlag batchFlag);⎕TRAP;T2;rc;log;expected
2+
⍝ Exercise `Run` with a `Cleanup` function that returns a result indicating failure
3+
⎕TRAP←(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
4+
r←T._Failed
5+
6+
#.⎕SHADOW'Temp'
7+
'Temp'#.⎕NS''
8+
T2←⎕NEW ##.Tester2 #.Temp
9+
#.Temp.⎕FX'r←Test_01 x;⎕TRAP' 'r←0'
10+
#.Temp.⎕FX'r←Cleanup' 'r←0'
11+
(rc log)←T2.Run 1
12+
→T.PassesIf 0=rc
13+
expected←'Looking for a function "Cleanup": found and executed but indicated failure by its result'
14+
→T.PassesIf∨/expected⍷∊log
15+
16+
r←T._OK
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
r←Test_Cleanup_03(debugFlag batchFlag);⎕TRAP;T2;rc;log;expected
2+
⍝ Exercise `Run` with a `Cleanup` function that returns no result
3+
⎕TRAP←(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
4+
r←T._Failed
5+
6+
#.⎕SHADOW'Temp'
7+
'Temp'#.⎕NS''
8+
T2←⎕NEW ##.Tester2 #.Temp
9+
#.Temp.⎕FX'r←Test_01 x;⎕TRAP' 'r←0'
10+
#.Temp.⎕FX'Cleanup' '⍝ This and that'
11+
(rc log)←T2.Run 1
12+
→T.PassesIf 0=rc
13+
expected←'Looking for a function "Cleanup": found and executed '
14+
→T.PassesIf∨/expected⍷∊log,¨⊂' '
15+
16+
r←T._OK
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
r←Test_Cleanup_04(debugFlag batchFlag);⎕TRAP;T2;rc;log;expected
2+
⍝ Exercise `Run` with a `Cleanup` function that requires a right argument and returns a result indicating success
3+
⎕TRAP←(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
4+
r←T._Failed
5+
6+
#.⎕SHADOW'Temp'
7+
'Temp'#.⎕NS''
8+
T2←⎕NEW ##.Tester2 #.Temp
9+
#.Temp.⎕FX'r←Test_01 x;⎕TRAP' 'r←0'
10+
#.Temp.⎕FX'r←Cleanup ps' 'r←1'
11+
(rc log)←T2.Run 1
12+
→T.PassesIf 0=rc
13+
expected←'Looking for a function "Cleanup": found and executed successfully'
14+
→T.PassesIf∨/expected⍷∊log
15+
16+
r←T._OK
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
r←Test_Cleanup_05(debugFlag batchFlag);⎕TRAP;T2;rc;log;expected
2+
⍝ Exercise `Run` with a `Cleanup` function that requires a right argument and returns a result indicating failure
3+
⎕TRAP←(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
4+
r←T._Failed
5+
6+
#.⎕SHADOW'Temp'
7+
'Temp'#.⎕NS''
8+
T2←⎕NEW ##.Tester2 #.Temp
9+
#.Temp.⎕FX'r←Test_01 x;⎕TRAP' 'r←0'
10+
#.Temp.⎕FX'r←Cleanup ps' 'r←0'
11+
(rc log)←T2.Run 1
12+
→T.PassesIf 0=rc
13+
expected←'Looking for a function "Cleanup": found and executed but indicated failure by its result'
14+
→T.PassesIf∨/expected⍷∊log
15+
16+
r←T._OK
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
r←Test_Cleanup_06(debugFlag batchFlag);⎕TRAP;T2;rc;log;expected
2+
⍝ Exercise `Run` with a `Cleanup` function that requires a right argument and returns no result
3+
⎕TRAP←(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
4+
r←T._Failed
5+
6+
#.⎕SHADOW'Temp'
7+
'Temp'#.⎕NS''
8+
T2←⎕NEW ##.Tester2 #.Temp
9+
#.Temp.⎕FX'r←Test_01 x;⎕TRAP' 'r←0'
10+
#.Temp.⎕FX'Cleanup ps' '⍝ This and that'
11+
(rc log)←T2.Run 1
12+
→T.PassesIf 0=rc
13+
expected←'Looking for a function "Cleanup": found and executed '
14+
→T.PassesIf∨/expected⍷∊log,¨⊂' '
15+
16+
r←T._OK
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
r←Test_Cleanup_10(debugFlag batchFlag);⎕TRAP;T2;rc;log;expected
2+
⍝ Exercise `Run` with a `Cleanup` function for a specific group that returns a result indicating success
3+
⎕TRAP←(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
4+
r←T._Failed
5+
6+
#.⎕SHADOW'Temp'
7+
'Temp'#.⎕NS''
8+
T2←⎕NEW ##.Tester2 #.Temp
9+
#.Temp.⎕FX'r←Test_Foo_01 x;⎕TRAP' 'r←0'
10+
#.Temp.⎕FX'r←Cleanup_Foo' 'r←0'
11+
(rc log)←T2.Run 1
12+
→T.PassesIf 0=rc
13+
expected←'Looking for a group function "Cleanup_Foo": found and executed successfully'
14+
→T.PassesIf∨/expected⍷∊log
15+
16+
r←T._OK
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
r←Test_Cleanup_11(debugFlag batchFlag);⎕TRAP;T2;rc;log;expected
2+
⍝ Exercise `Run` with a `Cleanup` function for a specific group that returns a result indicating failure
3+
⎕TRAP←(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
4+
r←T._Failed
5+
6+
#.⎕SHADOW'Temp'
7+
'Temp'#.⎕NS''
8+
T2←⎕NEW ##.Tester2 #.Temp
9+
#.Temp.⎕FX'r←Test_Foo_01 x;⎕TRAP' 'r←0'
10+
#.Temp.⎕FX'r←Cleanup_Foo' 'r←0'
11+
(rc log)←T2.Run 1
12+
→T.PassesIf 0=rc
13+
expected←'Looking for a group function "Cleanup_Foo": found and executed successfully'
14+
→T.PassesIf∨/expected⍷∊log
15+
16+
r←T._OK
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
r←Test_Cleanup_12(debugFlag batchFlag);⎕TRAP;T2;rc;log;expected
2+
⍝ Exercise `Run` with a `Cleanup` function for a specific group that returns no result
3+
⎕TRAP←(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
4+
r←T._Failed
5+
6+
#.⎕SHADOW'Temp'
7+
'Temp'#.⎕NS''
8+
T2←⎕NEW ##.Tester2 #.Temp
9+
#.Temp.⎕FX'r←Test_Foo_01 x;⎕TRAP' 'r←0'
10+
#.Temp.⎕FX'Cleanup_Foo' '⍝ This and that'
11+
(rc log)←T2.Run 1
12+
→T.PassesIf 0=rc
13+
expected←'Looking for a group function "Cleanup_Foo": found and executed '
14+
→T.PassesIf∨/expected⍷∊log,¨⊂' '
15+
16+
r←T._OK
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
r←Test_Cleanup_13(debugFlag batchFlag);⎕TRAP;T2;rc;log;expected
2+
⍝ Exercise `Run` with a `Cleanup` function for a specific group that requires ⍵ and returns a result indicating success
3+
⎕TRAP←(999 'C' '∘∘∘ ⍝ Deliberate error')(0 'N')
4+
r←T._Failed
5+
6+
#.⎕SHADOW'Temp'
7+
'Temp'#.⎕NS''
8+
T2←⎕NEW ##.Tester2 #.Temp
9+
#.Temp.⎕FX'r←Test_Foo_01 x;⎕TRAP' 'r←0'
10+
#.Temp.⎕FX'r←Cleanup_Foo ps' 'r←0'
11+
(rc log)←T2.Run 1
12+
→T.PassesIf 0=rc
13+
expected←'Looking for a group function "Cleanup_Foo": found and executed successfully'
14+
→T.PassesIf∨/expected⍷∊log
15+
16+
r←T._OK

0 commit comments

Comments
 (0)