Adapt Assert.Ok() method to the new backtrace format.
[GB.TEST] * BUG: Adapt Assert.Ok() method to the new backtrace format.
This commit is contained in:
parent
2789fbc305
commit
0c06ea3dc6
2 changed files with 30 additions and 16 deletions
|
@ -60,16 +60,16 @@ Public Sub Subtests()
|
||||||
|
|
||||||
Test.Plan(15 + 1)
|
Test.Plan(15 + 1)
|
||||||
Assert.Equals($aSubtestEvents.Count, 15, "Event count is correct")
|
Assert.Equals($aSubtestEvents.Count, 15, "Event count is correct")
|
||||||
Assert.Equals($aSubtestEvents[00], "Diag")
|
Assert.Equals($aSubtestEvents[0], "Diag")
|
||||||
Assert.Equals($aSubtestEvents[01], "Else")
|
Assert.Equals($aSubtestEvents[1], "Else")
|
||||||
Assert.Equals($aSubtestEvents[02], "Begin")
|
Assert.Equals($aSubtestEvents[2], "Begin")
|
||||||
Assert.Equals($aSubtestEvents[03], "Ok")
|
Assert.Equals($aSubtestEvents[3], "Ok")
|
||||||
Assert.Equals($aSubtestEvents[04], "Ok")
|
Assert.Equals($aSubtestEvents[4], "Ok")
|
||||||
Assert.Equals($aSubtestEvents[05], "NotOk")
|
Assert.Equals($aSubtestEvents[5], "NotOk")
|
||||||
Assert.Equals($aSubtestEvents[06], "Plan")
|
Assert.Equals($aSubtestEvents[6], "Plan")
|
||||||
Assert.Equals($aSubtestEvents[07], "End")
|
Assert.Equals($aSubtestEvents[7], "End")
|
||||||
Assert.Equals($aSubtestEvents[08], "Ok")
|
Assert.Equals($aSubtestEvents[8], "Ok")
|
||||||
Assert.Equals($aSubtestEvents[09], "Else")
|
Assert.Equals($aSubtestEvents[9], "Else")
|
||||||
Assert.Equals($aSubtestEvents[10], "Begin")
|
Assert.Equals($aSubtestEvents[10], "Begin")
|
||||||
Assert.Equals($aSubtestEvents[11], "Plan")
|
Assert.Equals($aSubtestEvents[11], "Plan")
|
||||||
Assert.Equals($aSubtestEvents[12], "NotOk")
|
Assert.Equals($aSubtestEvents[12], "NotOk")
|
||||||
|
|
|
@ -9,11 +9,15 @@ Export
|
||||||
|
|
||||||
Public _IntendedFailure As Boolean
|
Public _IntendedFailure As Boolean
|
||||||
|
|
||||||
|
Private $aIgnore As String[] = ["Assert", "Test", "TestCase", "TestSuite", "TapPrinter"]
|
||||||
|
|
||||||
'' Assert that Result = True
|
'' Assert that Result = True
|
||||||
Public Sub Ok(Result As Boolean, Optional Description As String) As Boolean
|
Public Sub Ok(Result As Boolean, Optional Description As String) As Boolean
|
||||||
|
|
||||||
Dim bRes As Boolean
|
Dim bRes As Boolean
|
||||||
Dim bt As String[]
|
Dim bt As String[]
|
||||||
|
Dim sStack As String
|
||||||
|
Dim iPos As Integer
|
||||||
|
|
||||||
If Test._InSetup = True Then
|
If Test._InSetup = True Then
|
||||||
Test.BailOut(("Failure: Assertion forbidden inside _Setup or _Teardown."))
|
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
|
_IntendedFailure = False
|
||||||
|
|
||||||
bt = System.Backtrace
|
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)
|
' 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."
|
||||||
If bt.Count = 0 Then
|
' bt.Remove(0)
|
||||||
Goto DAWAI
|
' If bt.Count = 0 Then
|
||||||
Endif
|
' Goto DAWAI
|
||||||
Wend
|
' 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:
|
DAWAI:
|
||||||
If bt.Count > 0 Then
|
If bt.Count > 0 Then
|
||||||
Test._Next.Line = bt[0]
|
Test._Next.Line = bt[0]
|
||||||
|
|
Loading…
Reference in a new issue