2020-02-23 12:38:53 +01:00
|
|
|
' Gambas test file
|
|
|
|
|
2020-05-11 22:26:08 +02:00
|
|
|
'Plan is one more because Test in _TeardownEach is counted twice!
|
2020-02-23 12:38:53 +01:00
|
|
|
|
|
|
|
Private $SetupIsDone As Boolean
|
|
|
|
Private $EachSetupIsDone As Boolean
|
|
|
|
|
2020-05-11 22:26:08 +02:00
|
|
|
Public Sub _Setup()
|
2020-02-23 12:38:53 +01:00
|
|
|
|
|
|
|
$SetupIsDone = True
|
2020-05-28 11:14:58 +02:00
|
|
|
Test.Note("Setup TestModule")
|
2020-02-23 12:38:53 +01:00
|
|
|
|
|
|
|
End
|
|
|
|
|
2020-05-11 22:26:08 +02:00
|
|
|
Public Sub _Teardown()
|
2020-02-23 12:38:53 +01:00
|
|
|
|
2020-04-26 10:48:30 +02:00
|
|
|
If Not $SetupIsDone Then
|
2020-05-11 22:26:08 +02:00
|
|
|
' will bail out if Test_Setup failed
|
|
|
|
Error.Raise("Test_Setup failed: _Setup was not executed correctly.")
|
2020-04-26 10:48:30 +02:00
|
|
|
Endif
|
2020-04-27 12:01:47 +02:00
|
|
|
Test.Note("Teardown TestModule")
|
2020-02-23 12:38:53 +01:00
|
|
|
|
|
|
|
End
|
|
|
|
|
2020-05-11 22:26:08 +02:00
|
|
|
Public Sub _SetupEach()
|
2020-02-23 12:38:53 +01:00
|
|
|
|
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
|
2020-05-28 11:14:58 +02:00
|
|
|
Test.Note("Setup Each")
|
2020-02-23 12:38:53 +01:00
|
|
|
|
|
|
|
End
|
|
|
|
|
2020-05-11 22:26:08 +02:00
|
|
|
Public Sub _TeardownEach()
|
2020-02-23 12:38:53 +01:00
|
|
|
|
2020-02-24 17:59:14 +01:00
|
|
|
Assert.Ok($EachSetupIsDone, "Each setup done")
|
2020-04-27 12:01:47 +02:00
|
|
|
Test.Note("Teardown Each")
|
2020-02-23 12:38:53 +01:00
|
|
|
$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
|