2020-04-10 11:15:17 +02:00
|
|
|
' Gambas test file
|
|
|
|
|
2020-05-01 10:42:29 +02:00
|
|
|
''' This test can be executed to test a summary. Will fail.
|
2020-04-10 11:15:17 +02:00
|
|
|
|
2020-05-01 10:42:29 +02:00
|
|
|
'' Will succeed
|
2020-04-10 11:15:17 +02:00
|
|
|
Public Sub DoSomeAsserts()
|
|
|
|
|
|
|
|
Assert.Pass("Bla 1")
|
|
|
|
Assert.Pass("Bla 2")
|
|
|
|
Assert.Pass("Bla 3")
|
|
|
|
|
|
|
|
End
|
|
|
|
|
2020-05-01 10:42:29 +02:00
|
|
|
'' Will succeed
|
|
|
|
Public Sub DoSkip()
|
2020-04-10 11:15:17 +02:00
|
|
|
|
2020-05-28 09:30:15 +02:00
|
|
|
Test.Skip("I skip this test to test Test.Skip.")
|
2020-04-10 11:15:17 +02:00
|
|
|
|
|
|
|
End
|
|
|
|
|
2020-05-01 10:42:29 +02:00
|
|
|
'' Will succeed
|
|
|
|
Public Sub DoTodo()
|
2020-04-10 11:15:17 +02:00
|
|
|
|
2020-05-28 09:30:15 +02:00
|
|
|
Test.Todo("This fails but is todo.")
|
2020-05-01 10:42:29 +02:00
|
|
|
Assert.Ok(False, "Must be ok.")
|
|
|
|
|
2020-05-28 09:30:15 +02:00
|
|
|
Test.Todo("This todo seems not to be removed yet, it is a bonus.")
|
2020-05-01 10:42:29 +02:00
|
|
|
Assert.Ok(True, "Must be ok.")
|
2020-04-10 11:15:17 +02:00
|
|
|
|
|
|
|
End
|
|
|
|
|
2020-05-28 11:14:58 +02:00
|
|
|
Public Sub TodoErrorCode()
|
|
|
|
|
|
|
|
Dim r As Float
|
|
|
|
Test.Plan(2)
|
|
|
|
|
|
|
|
Try r = 2 / 1
|
|
|
|
Test.Todo("See automatic diagnostics 1/2")
|
|
|
|
Assert.ErrorCode(26, "Division by zero?")
|
|
|
|
|
|
|
|
Try r = 2 / 0
|
|
|
|
Test.Todo("See automatic diagnostics 2/2")
|
|
|
|
Assert.ErrorCode(25, "Division by zero?")
|
|
|
|
|
|
|
|
End
|
|
|
|
|
|
|
|
|
2020-05-01 10:42:29 +02:00
|
|
|
'' Will fail
|
2020-04-10 11:15:17 +02:00
|
|
|
Public Sub DoOneFailure()
|
|
|
|
|
2020-06-07 00:37:59 +02:00
|
|
|
Test.IntendedFailure()
|
|
|
|
Assert.Ok(False, "Intentional failure")
|
|
|
|
|
|
|
|
End
|
|
|
|
|
|
|
|
Public Sub DoBadPlan()
|
|
|
|
|
|
|
|
Test._Subtest("Bad plan will appear in the summary", 2)
|
|
|
|
Assert.Ok(True)
|
|
|
|
Test._Finish()
|
2020-04-10 11:15:17 +02:00
|
|
|
|
2020-04-26 11:01:48 +02:00
|
|
|
End
|