gambas-source-code/comp/src/gb.test/.src/TestMyself/TestSetup.test

54 lines
1.1 KiB
Text
Raw Normal View History

' 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
Assert.Note("Setup TestModule")
End
Public Sub Teardown()
2020-04-26 10:48:30 +02:00
If Not $SetupIsDone Then
' will bail out if TestSetup failed
Error.Raise("TestSetup failed: Setup was not executed correctly.")
Endif
Assert.Note("Teardown TestModule")
End
Public Sub SetupEach()
Assert.NotOk($EachSetupIsDone, "Check if each was not setup.")
$EachSetupIsDone = True
Assert.Note("Setup Each")
End
Public Sub TeardownEach()
Assert.Ok($EachSetupIsDone, "Each setup done")
Assert.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