Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added behavior so that UT considers it a failure if

exception is expected but there is no exception
  • Loading branch information...
commit 85dbb34fe38bb6ee1ed651b43a69c4f11cd18cdc 1 parent 7dd34bd
Gianfranco Alongi authored
Showing with 13 additions and 5 deletions.
  1. +10 −5 UT.dyalog
  2. +3 −0  UT_tests.dyalog
15 UT.dyalog
View
@@ -1,7 +1,6 @@
:NameSpace UT
EN
-DM
Z LHS eq RHS
Z 1
@@ -15,10 +14,15 @@ DM ← ⍬
Tmp ( ⎕THIS) ⎕NS (( Tmp),'.',Function)
:Trap 0
Res execute_function Function
- Z Res
- :If 1 = ⍴⍴ Res
- Function display_expected_got Res
+ :If EN
+ Function display_expected_got EN
Z 0
+ :Else
+ Z Res
+ :If 1 = ⍴⍴ Res
+ Function display_expected_got Res
+ Z 0
+ :EndIf
:EndIf
:Else
:If EN
@@ -28,7 +32,6 @@ DM ← ⍬
Z 0
:EndIf
EN
- DM
:Else
display_exception Function
Z ⎕EN
@@ -85,10 +88,12 @@ DM ← ⍬
'TmpSpace' ⎕NS ''
'TmpSpace' ⎕NS '#.DISPLAY'
{'TmpSpace' ⎕NS } ¨ #.UT.⎕NL 3
+ {'TmpSpace' ⎕NS } ¨ #.UT.⎕NL 2
⎕CS 'TmpSpace'
⎕SE.SALT.Load Path
⎕CS get_namespace
{ ( ⎕THIS) ⎕NS '#.UT.', } ¨ #.UT.⎕NL 3
+ { ( ⎕THIS) ⎕NS '#.UT.', } ¨ #.UT.⎕NL 2
Fns ⎕THIS.⎕NL 3
Fns ( is_test ¨ Fns) / Fns
Res run ¨ Fns
3  UT_tests.dyalog
View
@@ -54,6 +54,8 @@ single_line_exception_2_failing_TEST ← { #.UT.EN ← 3 ⋄ ⍳ }
4
+no_exception_single_line_exception_TEST { #.UT.EN 2 1 + 2 }
+
Z Tests
Z
Z , 1 #.UT.run 'single_line_TEST'
@@ -71,6 +73,7 @@ single_line_exception_2_failing_TEST ← { #.UT.EN ← 3 ⋄ ⍳ }
Z , 0 #.UT.run 'single_line_exception_2_failing_TEST'
Z , 1 #.UT.run 'multi_line_exception_3_TEST'
Z , 0 #.UT.run 'multi_line_exception_3_failing_TEST'
+ Z , 0 #.UT.run 'no_exception_single_line_exception_TEST'
:EndNameSpace
Please sign in to comment.
Something went wrong with that request. Please try again.