From 3fdfbe3b155db0fd895c85af9bb5ba5fed8e5192 Mon Sep 17 00:00:00 2001 From: Tobias Boege Date: Mon, 24 Feb 2020 14:55:00 +0100 Subject: [PATCH] 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. --- comp/src/gb.test.tap/.src/Assert.class | 14 +++++++++++--- comp/src/gb.test.tap/.src/Tap/TapPrinter.class | 4 ++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/comp/src/gb.test.tap/.src/Assert.class b/comp/src/gb.test.tap/.src/Assert.class index 8f549cd04..17ece9c4d 100644 --- a/comp/src/gb.test.tap/.src/Assert.class +++ b/comp/src/gb.test.tap/.src/Assert.class @@ -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 diff --git a/comp/src/gb.test.tap/.src/Tap/TapPrinter.class b/comp/src/gb.test.tap/.src/Tap/TapPrinter.class index dba0780df..282a1beea 100644 --- a/comp/src/gb.test.tap/.src/Tap/TapPrinter.class +++ b/comp/src/gb.test.tap/.src/Tap/TapPrinter.class @@ -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