| 1 |
' |
| 2 |
' This file is part of the LibreOffice project. |
| 3 |
' |
| 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/. |
| 7 |
' |
| 8 |
|
| 9 |
Option Explicit |
| 10 |
|
| 11 |
Function doUnitTest() As String |
| 12 |
TestUtil.TestInit |
| 13 |
verify_testIif |
| 14 |
doUnitTest = TestUtil.GetResult() |
| 15 |
End Function |
| 16 |
|
| 17 |
Sub verify_testIif |
| 18 |
On Error GoTo errorHandler |
| 19 |
|
| 20 |
TestUtil.AssertEqual(IIF(True, 10, 12), 10, "IIF(True, 10, 12)") |
| 21 |
|
| 22 |
' tdf#149151 |
| 23 |
' Without the fix, this would fail with "hit error handler - 9: Index out of defined range" |
| 24 |
TestUtil.Assert(IsArray(Iif(True, Array("A","B"), Array("B","A"))), "IsArray(Iif(True, Array(""A"",""B""), Array(""B"",""A"")))") |
| 25 |
TestUtil.AssertEqualStrict(Iif(True, Array("A","B"), Array("B","A"))(0), "A", "Iif(True, Array(""A"",""B""), Array(""B"",""A""))(0)") |
| 26 |
TestUtil.AssertEqualStrict(Iif(True, Array("A","B"), Array("B","A"))(1), "B", "Iif(True, Array(""A"",""B""), Array(""B"",""A""))(1)") |
| 27 |
|
| 28 |
Exit Sub |
| 29 |
errorHandler: |
| 30 |
TestUtil.ReportErrorHandler("verify_testIif", Err, Error$, Erl) |
| 31 |
End Sub |