gambas-source-code/.src/TestMyself/d8e8fca2dc0f896fd7cb4cb0031ba249TestIntentionalError.class
Christof Thalhofer 9d851fc246 refact
2018-01-12 09:52:53 +01:00

33 lines
705 B
Text

' Gambas class file
'' Name of this class has to start with d8e8fca2dc0f896fd7cb4cb0031ba249 to signal that its an internal test
Inherits ATestContainer
Public Const constDegUnittestSelftest As Boolean = True
Public Sub TestError()
Dim a As Long
If Me.Debug Then
Print "GuTestIntentionalError::TestError"
Endif
Try a = 3 / 0
Me.Result.AssertError(Error.Code, Error.Text)
'Try a = 2 * 3
Me.Result.AssertError(Error.Code, Error.Text, 26, "Intentional Failure. If this is a failure, then all is ok.")
End
Public Sub TestDivisionByZeroError()
Dim a As Long
Me.Result.AddTrace("This will be a crash, then its ok")
'This is a crash
a = 3 / 0
End