6f4c24c3e1
[GB.TEST] * NEW: Assert.IntendedFailure move to Test.IntendedFailure * NEW: TAllAsserts tests all assertions (3 todo left)
53 lines
1.1 KiB
Text
53 lines
1.1 KiB
Text
' Gambas test file
|
|
|
|
'Plan is one more because Test in _TeardownEach is counted twice!
|
|
|
|
Private $SetupIsDone As Boolean
|
|
Private $EachSetupIsDone As Boolean
|
|
|
|
Public Sub _Setup()
|
|
|
|
$SetupIsDone = True
|
|
Test.Note("Setup TestModule")
|
|
|
|
End
|
|
|
|
Public Sub _Teardown()
|
|
|
|
If Not $SetupIsDone Then
|
|
' will bail out if Test_Setup failed
|
|
Error.Raise("Test_Setup failed: _Setup was not executed correctly.")
|
|
Endif
|
|
Test.Note("Teardown TestModule")
|
|
|
|
End
|
|
|
|
Public Sub _SetupEach()
|
|
|
|
Assert.NotOk($EachSetupIsDone, "Check if each was not setup.")
|
|
$EachSetupIsDone = True
|
|
Test.Note("Setup Each")
|
|
|
|
End
|
|
|
|
Public Sub _TeardownEach()
|
|
|
|
Assert.Ok($EachSetupIsDone, "Each setup done")
|
|
Test.Note("Teardown Each")
|
|
$EachSetupIsDone = False
|
|
|
|
End
|
|
|
|
Public Sub TestFirst()
|
|
|
|
Assert.Ok($SetupIsDone, "Check if setup was successful.")
|
|
Assert.Ok($EachSetupIsDone, "Check if setup each was successful.")
|
|
Assert.StringEquals("ja", "ja", "Fake test")
|
|
|
|
End
|
|
|
|
Public Sub NameOfMethodDoesNotStartWithTest()
|
|
|
|
Assert.StringEquals("no", "no", "Fake test")
|
|
|
|
End
|