summaryrefslogtreecommitdiffstats
path: root/basic/qa/basic_coverage/test_optional_paramters_basic.bas
diff options
context:
space:
mode:
Diffstat (limited to 'basic/qa/basic_coverage/test_optional_paramters_basic.bas')
-rw-r--r--basic/qa/basic_coverage/test_optional_paramters_basic.bas22
1 files changed, 22 insertions, 0 deletions
diff --git a/basic/qa/basic_coverage/test_optional_paramters_basic.bas b/basic/qa/basic_coverage/test_optional_paramters_basic.bas
index a684fc256054..82880e11bdde 100644
--- a/basic/qa/basic_coverage/test_optional_paramters_basic.bas
+++ b/basic/qa/basic_coverage/test_optional_paramters_basic.bas
@@ -1,3 +1,10 @@
+' This file is part of the LibreOffice project.
+'
+' This Source Code Form is subject to the terms of the Mozilla Public
+' License, v. 2.0. If a copy of the MPL was not distributed with this
+' file, You can obtain one at http://mozilla.org/MPL/2.0/.
+'
+
Option Explicit
Type testObject
@@ -125,6 +132,12 @@ Sub verify_testOptionalsBasic()
' - Actual : 448 (Actual value of the variable)
TestUtil.AssertEqual(TestObjectError, 449, "TestObjectError")
+ ' tdf#151503 - error handling of missing optional parameters (boolean operations)
+ ' Without the fix in place, this test would have failed with:
+ ' - Expected: 449 (ERRCODE_BASIC_NOT_OPTIONAL - Argument not optional)
+ ' - Actual : 0 (No error code since a missing parameter evaluates to true)
+ TestUtil.AssertEqual(TestBooleanOperations, 449, "TestBooleanOperations")
+
Exit Sub
errorHandler:
TestUtil.ReportErrorHandler("verify_testOptionalsBasic", Err, Error$, Erl)
@@ -229,6 +242,15 @@ errorHandler:
TestObjectError = Err()
End Function
+Function TestBooleanOperations(Optional optBool As Boolean)
+On Error GoTo errorHandler
+ if optBool then
+ TestBooleanOperations = 0
+ end if
+errorHandler:
+ TestBooleanOperations = Err()
+End Function
+
Function CollectionSum(C)
Dim idx As Integer
CollectionSum = 0