e6e9b4b1b0
[GB.TEST] * NEW: TapParser can now parse subtests. Consequently, TestRunner assembles a tree of TestAssertions. * BUG: Remove trailing '\r' characters from TapStream lines. By our convention a subtest is opened by a "Test ..." line and closed by its summarizing "ok" / "not ok" assertion. This commit regresses on TInternals's reflection tests because I added tests for the parser and runner which need event handlers to do their testing. These are unintentionally detected as test methods.
50 lines
1.4 KiB
Text
50 lines
1.4 KiB
Text
' Gambas class file
|
|
|
|
''' This class represents an "ok" or "not ok" line in TAP.
|
|
''' It is generated by TapPrinter and TapParser.
|
|
|
|
Export
|
|
|
|
'' Possible values for the Directive field
|
|
Public Enum NONE = 0, TODO = 1, SKIP
|
|
|
|
'' The serial number of this test.
|
|
Public Id As Long = 0
|
|
'' Whether "ok" or "not ok" was printed.
|
|
Public Ok As Boolean = False
|
|
'' The test description.
|
|
Public Description As String = Null
|
|
'' The TAP directive constant NONE, TODO or SKIP.
|
|
Public Directive As Integer = NONE
|
|
'' The comment after the test description and directive, if any.
|
|
Public Comment As String = Null
|
|
'' If this is a subtest summary assertion, here are the child assertions.
|
|
Public Subtests As New TestAssertion[]
|
|
'' If this is a subtest summary assertion, its plan line.
|
|
Public SubPlanned As Integer
|
|
|
|
'' Whether the test counts as succeeded. A "not ok" test can succeed if it was marked as TODO.
|
|
Property Read Success As Boolean
|
|
'' Whether all subtests succeeded.
|
|
Property Read SubSuccess As Boolean
|
|
|
|
Private Function Success_Read() As Boolean
|
|
|
|
Return Ok Or (Directive = TODO)
|
|
|
|
End
|
|
|
|
Private Function SubSuccess_Read() As Boolean
|
|
|
|
If Not subtests.Count Then Return Me.Success
|
|
|
|
Dim bRes As Boolean = Not (Subtests.Count <> SubPlanned)
|
|
Dim iInd As Integer = 0
|
|
|
|
While bRes And (iInd < Subtests.Count)
|
|
bRes = bRes And Subtests[iInd].SubSuccess
|
|
Inc iInd
|
|
Wend
|
|
Return bRes
|
|
|
|
End
|