gambas-source-code/main/lib/test/gb.test/.src/TestMyself/TFailures.test
Christof Thalhofer 6f4c24c3e1 gb.test test all assertions
[GB.TEST]
* NEW: Assert.IntendedFailure move to Test.IntendedFailure
* NEW: TAllAsserts tests all assertions (3 todo left)
2020-05-28 11:14:58 +02:00

61 lines
1.2 KiB
Text

' Gambas test file
''' Every test in this class failes, but is reverted to be reported as good
Public Sub StringFailure()
Test.IntendedFailure()
Assert.StringEquals("Lisa", "Paul", "Intentional String failure. Ok if not ok.")
End
Public Sub LongFailure()
Test.IntendedFailure()
Assert.Equals(2, 3, "Intentional Long failure. Ok if not ok.")
End
Public Sub LongTypeMismatchFailure()
Dim s As String = "3.0"
Test.IntendedFailure()
Assert.Equals(s, 3, "Intentional Long type mismatch failure. Ok if not ok.")
End
Public Sub EqualsFailure()
Dim oOne, oTwo As Object
Test.Note("Equals failures")
Test.IntendedFailure()
Assert.Equals(2, 3)
Test.IntendedFailure()
Assert.Equals("3", 2.0)
Test.IntendedFailure()
Assert.Equals("2", 2.1)
oOne = New Test
oTwo = New Test
Test.IntendedFailure()
Assert.Equals(oOne, oTwo)
End
Public Sub Error()
Dim a As Long
Try a = 3 / 0
Test.IntendedFailure()
Assert.ErrorCode(5, "Wanted error 5. Ok if not ok.")
' No Error, AssertError has to report a failure
Test.IntendedFailure()
Assert.Error("No Error but error expected. Ok if not ok.")
End