Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / basic / qa / vba_tests / join.vb
blob8d6dd46dcd6544ff39ba639340b8a9328282de1b
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_testJoin
15 doUnitTest = TestUtil.GetResult()
16 End Function
18 Sub verify_testJoin()
19 On Error GoTo errorHandler
20 Dim vaArray(2) As String
21 vaArray(0) = "string1"
22 vaArray(1) = "string2"
23 vaArray(2) = "string3"
25 TestUtil.AssertEqual(Join(vaArray), "string1 string2 string3", "Join(vaArray)")
26 TestUtil.AssertEqual(Join(vaArray, " "), "string1 string2 string3", "Join(vaArray, "" "")")
27 TestUtil.AssertEqual(Join(vaArray, "<>"), "string1<>string2<>string3", "Join(vaArray, ""<>"")")
28 TestUtil.AssertEqual(Join(vaArray, ""), "string1string2string3", "Join(vaArray, """")")
30 ' tdf#141474 keyword names need to match that of VBA
31 Dim aList(0 to 7) As String : aList = Array("(", "Star", "|", "Open", "|", "Libre", ")", "Office")
32 TestUtil.AssertEqual(Join(sourceArray:=aList), "( Star | Open | Libre ) Office", "Join() with 1 keyword name")
33 TestUtil.AssertEqual(Join(delimiter:="", sourceArray:=aList), "(Star|Open|Libre)Office", "Join() with 2 keyword names")
35 Exit Sub
36 errorHandler:
37 TestUtil.ReportErrorHandler("verify_testJoin", Err, Error$, Erl)
38 End Sub