summaryrefslogtreecommitdiff
path: root/basic/qa
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2021-08-03 20:56:22 +0200
committerAndreas Heinisch <andreas.heinisch@yahoo.de>2021-08-10 12:23:19 +0200
commit3bcfb1aac1f43f16c579486264103ebd4f3f829b (patch)
tree359a6d297ee164857ecc61055f3866b791bbe770 /basic/qa
parentd5c8684c05e33e87033d595c98fb50acd42d56a8 (diff)
tdf#143707 - Change strategy to support suffix type characters
In order to support the correct data type of numeric constants, booleans, and default values for strings, the strategy to transport the data type character to the runtime has been changed. The type character will be added after the literal and the string termination symbol in order to keep compatibility. This allows to retrieve the correct type in StepLOADNC and in StepPARAM. Any legacy written images are still possible to process, since if there is a suffix type character where the data type character was directly written after the numeric constant, it will be processed in StepLOADNC. Without this fix, an optional parameter of type Variant, would still include the suffixe type character, and will not be converted to the correct type in StepPARAM. Change-Id: I86c8192c6dc28457053fa7b23a073420e45407b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119945 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Diffstat (limited to 'basic/qa')
-rw-r--r--basic/qa/vba_tests/optional_paramters.vb10
-rw-r--r--basic/qa/vba_tests/typename.vb10
2 files changed, 20 insertions, 0 deletions
diff --git a/basic/qa/vba_tests/optional_paramters.vb b/basic/qa/vba_tests/optional_paramters.vb
index 9001ab952de9..d47854d2fb69 100644
--- a/basic/qa/vba_tests/optional_paramters.vb
+++ b/basic/qa/vba_tests/optional_paramters.vb
@@ -22,6 +22,12 @@ End Function
Sub verify_testOptionalsVba()
On Error GoTo errorHandler
+ ' tdf#143707 - check correct initialization of default value for optionals
+ ' Without the fix in place, this test would have failed with
+ ' - Expected: 123
+ ' - Actual : 123%
+ TestUtil.AssertEqual(TestOptVariantInit(), 123, "TestOptVariantInit()")
+
' optionals with variant datatypes
TestUtil.AssertEqual(TestOptVariant(), 123, "TestOptVariant()")
TestUtil.AssertEqual(TestOptVariant(123), 246, "TestOptVariant(123)")
@@ -113,6 +119,10 @@ errorHandler:
TestUtil.ReportErrorHandler("verify_testOptionalsVba", Err, Error$, Erl)
End Sub
+Function TestOptVariantInit(Optional A As Variant = 123)
+ TestOptVariantInit = A
+End Function
+
Function TestOptVariant(Optional A, Optional B As Variant = 123)
TestOptVariant = OptNumberSum(IsMissing(A), A, IsMissing(B), B)
End Function
diff --git a/basic/qa/vba_tests/typename.vb b/basic/qa/vba_tests/typename.vb
index 4442cba55e98..98bfd58feda4 100644
--- a/basic/qa/vba_tests/typename.vb
+++ b/basic/qa/vba_tests/typename.vb
@@ -53,7 +53,17 @@ Sub verify_testTypeName()
TestUtil.AssertEqual(TypeName(TestCurrSign), "Currency", "TypeName(TestCurrSign)")
TestUtil.AssertEqual(TypeName(TestStrSign), "String", "TypeName(TestStrSign)")
+ ' tdf#143707 - check correct initialization of default value for optionals
+ ' Without the fix in place, this test would have failed with
+ ' - Expected: Integer
+ ' - Actual : String
+ TestUtil.AssertEqual(TestOptVariantInit(), "Integer", "TestOptVariantInit()")
+
Exit Sub
errorHandler:
TestUtil.ReportErrorHandler("verify_testTypeName", Err, Error$, Erl)
End Sub
+
+Function TestOptVariantInit(Optional A As Variant = 123)
+ TestOptVariantInit = TypeName(A)
+End Function