gb.test.tap: Allow Assert to be reset

[GB.TEST.TAP]
* NEW: Add Reset() method to Assert. Useful if you use the same (automatic) instance for multiple TAP streams.
* BUG: Fix state handling in TapPrinter.Finished.
This commit is contained in:
Tobias Boege 2020-02-24 14:55:00 +01:00
parent 73eafee853
commit 3fdfbe3b15
2 changed files with 13 additions and 5 deletions

View file

@ -17,13 +17,21 @@ End Struct
Property Output As Stream
Private $aActiveTests As New Subtest[]
Private $aActiveTests As Subtest[]
Private $hCurrent As New Subtest
Private $hOutput As Stream = File.Out
Private $hOutput As Stream
Public Sub _new()
With $hCurrent = New Subtest
Reset()
End
Public Sub Reset()
$aActiveTests = New Subtest[]
$hOutput = File.Out
With $hCurrent = New Subtest
.Printer = New TapPrinter As "Printer"
.Indent = 0
.Success = True

View file

@ -45,11 +45,11 @@ End
Public Sub Finish()
If $iPlan > Tap.NO_PLAN Then Return ' already printed the "plan" line
If $bFinished Then Error.Raise(("Tests already finished"))
$bFinished = True
If $iPlan > Tap.NO_PLAN Then Return ' already printed the "plan" line
$iPlan = $iTestsRun
Print("1.." & $iPlan)
$bFinished = True
End