Permalink
Browse files

Going down the alternate track which Morten Kromberg seems to like be…

…tter anyway.

Using variables which indicate Exception expectation
  • Loading branch information...
1 parent 605806d commit 2bf5772efe80214350d922e9a7f8b857a084fb9d @Gianfrancoalongi committed Nov 19, 2012
Showing with 53 additions and 2 deletions.
  1. +14 −2 UT.dyalog
  2. +3 −0 UT_tests.dyalog
  3. +36 −0 requirement_specification.org
View
@@ -1,5 +1,8 @@
:NameSpace UT
+EN
+DM
+
Z LHS eq RHS
Z 1
:If LHS RHS
@@ -18,8 +21,17 @@
Z 0
:EndIf
:Else
- display_exception Function
- Z ⎕EN
+ :If EN
+ Z 1
+ :If EN ⎕EN
+ Z 0
+ :EndIf
+ EN
+ DM
+ :Else
+ display_exception Function
+ Z ⎕EN
+ :EndIf
:EndTrap
⎕EX Function
View
@@ -40,6 +40,8 @@ single_line_syntax_error_TEST ← { 1 #.UT.eq ⍳ }
Z A #.UT.eq B A
+single_line_exception_2_TEST { #.UT.EN 2 }
+
Z Tests
Z
Z , 1 #.UT.run 'single_line_TEST'
@@ -53,6 +55,7 @@ single_line_syntax_error_TEST ← { 1 #.UT.eq ⍳ }
Z , (2 0 2) #.UT.run_file '/home/gianfranco/APL/UnitTestFrameWork/UTFile.dyalog'
Z , 2 #.UT.run 'single_line_syntax_error_TEST'
Z , 3 #.UT.run 'multi_line_index_error_TEST'
+ Z , 1 #.UT.run 'single_line_exception_2_TEST'
:EndNameSpace
@@ -162,6 +162,42 @@ equal to TEXT this will return 1, in all other cases - it will return 0.
exception_TEST ← { LHS UT.exception RHS }
#+END_EXAMPLE
+As of now - I do not know how to achieve this, given that I do not
+know how to construct macros in order to transform
+
+#+BEGIN_EXAMPLE
+ LHS OP RHS
+#+END_EXAMPLE
+
+into a trap with ⎕EN and ⎕DM testing
+
+#+BEGIN_EXAMPLE
+ :Trap 0
+ RHS
+ :Else
+ ...
+ :EndTrap
+#+END_EXAMPLE
+
+The new description will then be. It shall be possible to use
+UT-namespace global variables to express that a function call
+in the test will generate an exception.
+
+#+BEGIN_EXAMPLE
+ exception_TEST ← { UT.EN ← 2 ⋄ ⍳ }
+#+END_EXAMPLE
+
+the multi line version would be similar
+
+#+BEGIN_EXAMPLE
+∇ multi_line_exception_TEST
+ UT.EN ← 6
+ UT.DM ← 'some message'
+ some_function_call
+∇
+#+END_EXAMPLE
+
+
** [t] Coverage report from Unit Test execution
There shall be a setting indicating that a coverage report is to be generated

0 comments on commit 2bf5772

Please sign in to comment.