2020-02-23 12:38:53 +01:00
|
|
|
' 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
|
2020-02-23 12:38:53 +01:00
|
|
|
Assert.Note("Teardown TestModule")
|
|
|
|
|
|
|
|
End
|
|
|
|
|
|
|
|
Public Sub SetupEach()
|
|
|
|
|
2020-02-24 17:59:14 +01:00
|
|
|
Assert.NotOk($EachSetupIsDone, "Check if each was not setup.")
|
2020-02-23 12:38:53 +01:00
|
|
|
$EachSetupIsDone = True
|
|
|
|
Assert.Note("Setup Each")
|
|
|
|
|
|
|
|
End
|
|
|
|
|
|
|
|
Public Sub TeardownEach()
|
|
|
|
|
2020-02-24 17:59:14 +01:00
|
|
|
Assert.Ok($EachSetupIsDone, "Each setup done")
|
2020-02-23 12:38:53 +01:00
|
|
|
Assert.Note("Teardown Each")
|
|
|
|
$EachSetupIsDone = False
|
|
|
|
|
|
|
|
End
|
|
|
|
|
|
|
|
Public Sub TestFirst()
|
|
|
|
|
2020-02-24 17:59:14 +01:00
|
|
|
Assert.Ok($SetupIsDone, "Check if setup was successful.")
|
|
|
|
Assert.Ok($EachSetupIsDone, "Check if setup each was successful.")
|
|
|
|
Assert.StringEquals("ja", "ja", "Fake test")
|
2020-02-23 12:38:53 +01:00
|
|
|
|
|
|
|
End
|
|
|
|
|
|
|
|
Public Sub NameOfMethodDoesNotStartWithTest()
|
|
|
|
|
2020-02-24 17:59:14 +01:00
|
|
|
Assert.StringEquals("no", "no", "Fake test")
|
2020-02-23 12:38:53 +01:00
|
|
|
|
|
|
|
End
|