Skip to content

Commit

Permalink
More refactoring with extract method
Browse files Browse the repository at this point in the history
  • Loading branch information
Gianfrancoalongi committed Dec 8, 2012
1 parent 95034b4 commit af26cd9
Showing 1 changed file with 26 additions and 13 deletions.
39 changes: 26 additions & 13 deletions UT.dyalog
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -21,26 +21,39 @@ EN ← ⍬
Z 0 Z 0


Z exception_number_does_not_match_expected
Z #.UT.EN ⎕EN

Z failure_exception_failed Function
Function display_expected_got #.UT.EN ⎕EN
Z 0

Z Function check_success_or_failure Res
:If expecting_an_exception
Z failure_due_to_no_exception Function
:Else
:If test_failure Res
Z Function failure_test_failed Res
:Else
Z Res
:EndIf
:EndIf

Z run Function;Res;Tmp Z run Function;Res;Tmp
Tmp 1 ⎕RSI Tmp 1 ⎕RSI
Tmp ( ⎕THIS) ⎕NS (( Tmp),'.',Function) Tmp ( ⎕THIS) ⎕NS (( Tmp),'.',Function)
:Trap 0 :Trap 0
Res execute_function Function Res execute_function Function
Z Function check_success_or_failure Res
:Else
:If expecting_an_exception :If expecting_an_exception
Z failure_due_to_no_exception Function :If exception_number_does_not_match_expected
:Else Z failure_exception_failed Function
:If test_failure Res
Z Function failure_test_failed Res
:Else :Else
Z Res Z 1
:EndIf
:EndIf
:Else
:If #.UT.EN
Z 1
:If #.UT.EN ⎕EN
Function display_expected_got #.UT.EN ⎕EN
Z 0
:EndIf :EndIf
#.UT.EN #.UT.EN
:Else :Else
Expand Down

0 comments on commit af26cd9

Please sign in to comment.