diff --git a/main/lib/test/gb.test/.src/TestMyself/TParser.test b/main/lib/test/gb.test/.src/TestMyself/TParser.test index 3eda78b8e..4775cf258 100644 --- a/main/lib/test/gb.test/.src/TestMyself/TParser.test +++ b/main/lib/test/gb.test/.src/TestMyself/TParser.test @@ -60,16 +60,16 @@ Public Sub Subtests() Test.Plan(15 + 1) Assert.Equals($aSubtestEvents.Count, 15, "Event count is correct") - Assert.Equals($aSubtestEvents[00], "Diag") - Assert.Equals($aSubtestEvents[01], "Else") - Assert.Equals($aSubtestEvents[02], "Begin") - Assert.Equals($aSubtestEvents[03], "Ok") - Assert.Equals($aSubtestEvents[04], "Ok") - Assert.Equals($aSubtestEvents[05], "NotOk") - Assert.Equals($aSubtestEvents[06], "Plan") - Assert.Equals($aSubtestEvents[07], "End") - Assert.Equals($aSubtestEvents[08], "Ok") - Assert.Equals($aSubtestEvents[09], "Else") + Assert.Equals($aSubtestEvents[0], "Diag") + Assert.Equals($aSubtestEvents[1], "Else") + Assert.Equals($aSubtestEvents[2], "Begin") + Assert.Equals($aSubtestEvents[3], "Ok") + Assert.Equals($aSubtestEvents[4], "Ok") + Assert.Equals($aSubtestEvents[5], "NotOk") + Assert.Equals($aSubtestEvents[6], "Plan") + Assert.Equals($aSubtestEvents[7], "End") + Assert.Equals($aSubtestEvents[8], "Ok") + Assert.Equals($aSubtestEvents[9], "Else") Assert.Equals($aSubtestEvents[10], "Begin") Assert.Equals($aSubtestEvents[11], "Plan") Assert.Equals($aSubtestEvents[12], "NotOk") diff --git a/main/lib/test/gb.test/.src/TestSuite/Assert.module b/main/lib/test/gb.test/.src/TestSuite/Assert.module index f33fd5e35..c448219d2 100644 --- a/main/lib/test/gb.test/.src/TestSuite/Assert.module +++ b/main/lib/test/gb.test/.src/TestSuite/Assert.module @@ -9,11 +9,15 @@ Export Public _IntendedFailure As Boolean +Private $aIgnore As String[] = ["Assert", "Test", "TestCase", "TestSuite", "TapPrinter"] + '' Assert that Result = True Public Sub Ok(Result As Boolean, Optional Description As String) As Boolean Dim bRes As Boolean Dim bt As String[] + Dim sStack As String + Dim iPos As Integer If Test._InSetup = True Then Test.BailOut(("Failure: Assertion forbidden inside _Setup or _Teardown.")) @@ -23,13 +27,23 @@ Public Sub Ok(Result As Boolean, Optional Description As String) As Boolean _IntendedFailure = False bt = System.Backtrace - While bt[0] Begins "Assert." Or bt[0] Begins "Test." Or bt[0] Begins "TestCase." Or bt[0] Begins "TestSuite." Or bt[0] Begins "TapPrinter." - bt.Remove(0) - If bt.Count = 0 Then - Goto DAWAI - Endif - Wend + + ' While bt[0] Begins "Assert." Or bt[0] Begins "Test." Or bt[0] Begins "TestCase." Or bt[0] Begins "TestSuite." Or bt[0] Begins "TapPrinter." + ' bt.Remove(0) + ' If bt.Count = 0 Then + ' Goto DAWAI + ' Endif + ' Wend + While bt.Count + sStack = bt[0] + If sStack Like "[[]*].*" Then sStack = Mid$(sStack, InStr(sStack, "]") + 2) + iPos = InStr(sStack, ".") + If iPos Then sStack = Left(sStack, iPos - 1) + If Not $aIgnore.Exist(sStack) Then Break + bt.Remove(0) + Wend + DAWAI: If bt.Count > 0 Then Test._Next.Line = bt[0]