gambas-source-code/main/lib/test/gb.test/.src/TestAssertion.class
Tobias Boege 939397a734 gb.test: Parse a skipping plan line
[GB.TEST]
* NEW: The parser can now parse a plan line which skips the entire test.
2020-06-01 06:30:52 +02:00

52 lines
1.5 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
'' If this is a subtest summary assertion, whether it was skipped completely.
Public SubSkippedAll As Boolean
'' 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