LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / basic / qa / vba_tests / cverr.vb
blob3a314de7617eb131255b6deac188106b64e7577c
2 ' This file is part of the LibreOffice project.
4 ' This Source Code Form is subject to the terms of the Mozilla Public
5 ' License, v. 2.0. If a copy of the MPL was not distributed with this
6 ' file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 Option VBASupport 1
10 Option Explicit
12 Function doUnitTest() As String
13 TestUtil.TestInit
14 verify_testCVErr
15 doUnitTest = TestUtil.GetResult()
16 End Function
18 Sub verify_testCVErr()
19 On Error GoTo errorHandler
21 TestUtil.AssertEqual(CStr(CVErr(3001)), "Error 3001", "CStr(CVErr(3001))")
22 TestUtil.AssertEqual(CStr(CVErr(xlErrDiv0)), "Error 2007", "CStr(CVErr(xlErrDiv0))")
23 TestUtil.AssertEqual(CStr(CVErr(xlErrNA)), "Error 2042", "CStr(CVErr(xlErrNA))")
24 TestUtil.AssertEqual(CStr(CVErr(xlErrName)), "Error 2029", "CStr(CVErr(xlErrName))")
25 TestUtil.AssertEqual(CStr(CVErr(xlErrNull)), "Error 2000", "CStr(CVErr(xlErrNull))")
26 TestUtil.AssertEqual(CStr(CVErr(xlErrNum)), "Error 2036", "CStr(CVErr(xlErrNum))")
27 TestUtil.AssertEqual(CStr(CVErr(xlErrRef)), "Error 2023", "CStr(CVErr(xlErrRef))")
28 TestUtil.AssertEqual(CStr(CVErr(xlErrValue)), "Error 2015", "CStr(CVErr(xlErrValue))")
30 ' tdf#79426 - passing an error object to a function
31 TestUtil.AssertEqual(TestCVErr(CVErr(2)), 2, "TestCVErr(CVErr(2))")
32 ' tdf#79426 - test with Error-Code 448 ( ERRCODE_BASIC_NAMED_NOT_FOUND )
33 TestUtil.AssertEqual(TestCVErr(CVErr(448)), 448, "TestCVErr(CVErr(448))")
35 Exit Sub
36 errorHandler:
37 TestUtil.ReportErrorHandler("verify_testCVErr", Err, Error$, Erl)
38 End Sub
40 Function TestCVErr(vErr As Variant)
41 Dim nValue As Integer
42 nValue = vErr
43 TestCVErr = nValue
44 End Function