summaryrefslogtreecommitdiff
path: root/basic/qa/vba_tests/error.vb
blob: 95725b7fabaf897305812dbb8cb9f832a5f74761 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Option VBASupport 1
Option Explicit

Function doUnitTest() As String
verify_testError
doUnitTest = TestUtilModule.GetResult()
End Function

Sub verify_testError()

    TestUtilModule.TestInit

    Dim testName As String
    Dim date1, date2
    testName = "Test Error function"
    On Error GoTo errorHandler

    date2 = Error(11)   'https://help.libreoffice.org/Basic/Error_Sub_Runtime
    date1 = "Division by zero."
    TestUtilModule.AssertTrue(date1 = date2, "the return Error is: " & date2)

    TestUtilModule.TestEnd

    Exit Sub
errorHandler:
        TestUtilModule.AssertTrue(False, testName & ": hit error handler")
End Sub