tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / basic / qa / basic_coverage / test_CallByName.bas
blob3eca805fb1a9c3f8e51ff2b94d1d642185115511
1 ' This file is part of the LibreOffice project.
3 ' This Source Code Form is subject to the terms of the Mozilla Public
4 ' License, v. 2.0. If a copy of the MPL was not distributed with this
5 ' file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 Option Explicit
10 Function doUnitTest() As String
11 TestUtil.TestInit
12 verify_CallByName
13 doUnitTest = TestUtil.GetResult()
14 End Function
16 Sub verify_CallByName()
17 Const _Get = 2, _Let = 4, _Method = 1, _Set = 8
19 On Error GoTo errorHandler
21 ' Basic modules are Objects
22 TestUtil.AssertEqual(CallByName(TestUtil, "failCount", _Get), 0, "CallByName(TestUtil, ""failCount"", _Get")
23 TestUtil.AssertEqual(CallByName(TestUtil, "passCount", _Get), 1, "CallByName(TestUtil, ""passCount"", _Get")
24 TestUtil.AssertEqual(CallByName(TestUtil, "GetResult", _Method), "OK", "CallByName(TestUtil, ""GetResult"", _Method")
26 ' Collection instances
27 Dim c As New Collection
28 c.Add(100, "1st") : c.Add(101)
29 TestUtil.AssertEqual(CallByName(c,"Count", _Get), 2, "CallByName(c,""Count"", _Get)")
30 c.Remove(2)
31 TestUtil.AssertEqual(CallByName(callType:=_Get, object:=c, procName:="Count"), 1, _
32 "CallByName(callType:=_Get, object:=c, procName:=""Count"")")
34 ' ClassModule instances or UNO services are 'CallByNamable' objects too!
35 ' see https://help.libreoffice.org/7.4/en-US/text/sbasic/shared/CallByName.html?DbPAR=BASIC#bm_id3150669
36 ' for more _Let and _Set examples
38 Exit Sub
39 errorHandler:
40 TestUtil.ReportErrorHandler("verify_CallByName", Err, Error$, Erl)
41 Resume Next
43 End Sub