gambas-source-code/main/lib/test/gb.test/.src/TestMyself/TSetup.test
Christof Thalhofer 09da14aa68 gb.test plan selftests and taskell
[GB.TEST]
*NEW: plan selftests
*NEW: forbid assertions in _Setup.. and _Teardown.. to ensure plan is always valid
2020-06-06 12:08:14 +02:00

51 lines
753 B
Text

' Gambas test file
'Plan is one more because Test in _TeardownEach is counted twice!
Private $Done As New String[]
Public Sub _Setup()
$Done.Add("Setup")
End
Public Sub _SetupEach()
$Done.Add("SetupEach")
End
Public Sub _TeardownEach()
$Done.Add("TeardownEach")
End
Public Sub A()
$Done.Add("A")
Test.Plan(1)
Assert.Equals($Done.Join(), "Setup,SetupEach,A")
End
Public Sub B()
Test.Plan(1)
$Done.Add("B")
Assert.Equals($Done.Join(), "Setup,SetupEach,A,TeardownEach,SetupEach,B")
End
Public Sub _Teardown()
$Done.Add("Teardown")
If $Done.Join() <> "Setup,SetupEach,A,TeardownEach,SetupEach,B,TeardownEach,Teardown" Then
Test.BailOut("_Teardown failed")
Endif
End