summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2022-01-07 10:19:28 +0100
committerAndreas Heinisch <andreas.heinisch@yahoo.de>2022-01-08 11:48:32 +0100
commit35aa82ef1c8047087e7eb76fe5abccbe48fbac1e (patch)
treeec09141425aa5dd197316424d4c58eaf90ab1532 /basic
parentd0445802a86d67b55b5e333a4c815d062b5e6036 (diff)
tdf#145693 - Argument name should be 'charcode' instead of 'string'
In addition, changed argument datatype from Int to Long. Change-Id: I702e09b6b8061d7cf00dd403e4681a0ab348d4c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128100 Tested-by: Andreas Heinisch <andreas.heinisch@yahoo.de> Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Diffstat (limited to 'basic')
-rw-r--r--basic/qa/basic_coverage/test_chr_method.bas30
-rw-r--r--basic/qa/cppunit/test_vba.cxx1
-rw-r--r--basic/qa/vba_tests/chr.vb3
-rw-r--r--basic/qa/vba_tests/chrw.vb31
-rw-r--r--basic/source/runtime/stdobj.cxx4
5 files changed, 67 insertions, 2 deletions
diff --git a/basic/qa/basic_coverage/test_chr_method.bas b/basic/qa/basic_coverage/test_chr_method.bas
new file mode 100644
index 000000000000..96d6fe3d9968
--- /dev/null
+++ b/basic/qa/basic_coverage/test_chr_method.bas
@@ -0,0 +1,30 @@
+'
+' 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
+
+Function doUnitTest() As String
+ TestUtil.TestInit
+ verify_testCHR
+ doUnitTest = TestUtil.GetResult()
+End Function
+
+Sub verify_testCHR()
+ On Error GoTo errorHandler
+
+ TestUtil.AssertEqual(Chr(87), "W", "Chr(87)")
+ TestUtil.AssertEqual(Chr(105), "i", "Chr(105)")
+ TestUtil.AssertEqual(Chr(35), "#", "Chr(35)")
+
+ ' tdf#145693 - argument name should be 'charcode' instead of 'string'
+ TestUtil.AssertEqual(Chr(charcode:=35), "#", "Chr(charcode:=35)")
+
+ Exit Sub
+errorHandler:
+ TestUtil.ReportErrorHandler("verify_testCHR", Err, Error$, Erl)
+End Sub
diff --git a/basic/qa/cppunit/test_vba.cxx b/basic/qa/cppunit/test_vba.cxx
index 089da748addb..818ba1c5f4c0 100644
--- a/basic/qa/cppunit/test_vba.cxx
+++ b/basic/qa/cppunit/test_vba.cxx
@@ -63,6 +63,7 @@ void VBATest::testMiscVBAFunctions()
"replace.vb",
"stringplusdouble.vb",
"chr.vb",
+ "chrw.vb",
"abs.vb",
"array.vb",
"asc.vb",
diff --git a/basic/qa/vba_tests/chr.vb b/basic/qa/vba_tests/chr.vb
index a561d7cd6545..5dc85a0c9157 100644
--- a/basic/qa/vba_tests/chr.vb
+++ b/basic/qa/vba_tests/chr.vb
@@ -21,6 +21,9 @@ Sub verify_testCHR()
TestUtil.AssertEqual(Chr(87), "W", "Chr(87)")
TestUtil.AssertEqual(Chr(105), "i", "Chr(105)")
TestUtil.AssertEqual(Chr(35), "#", "Chr(35)")
+
+ ' tdf#145693 - argument name should be 'charcode' instead of 'string'
+ TestUtil.AssertEqual(Chr(charcode:=35), "#", "Chr(charcode:=35)")
Exit Sub
errorHandler:
diff --git a/basic/qa/vba_tests/chrw.vb b/basic/qa/vba_tests/chrw.vb
new file mode 100644
index 000000000000..47bd28d7e1e3
--- /dev/null
+++ b/basic/qa/vba_tests/chrw.vb
@@ -0,0 +1,31 @@
+'
+' 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 VBASupport 1
+Option Explicit
+
+Function doUnitTest() As String
+ TestUtil.TestInit
+ verify_testCHRW
+ doUnitTest = TestUtil.GetResult()
+End Function
+
+Sub verify_testCHRW()
+ On Error GoTo errorHandler
+
+ TestUtil.AssertEqual(ChrW(87), "W", "ChrW(87)")
+ TestUtil.AssertEqual(ChrW(105), "i", "ChrW(105)")
+ TestUtil.AssertEqual(ChrW(35), "#", "ChrW(35)")
+
+ ' tdf#145693 - argument name should be 'charcode' instead of 'string'
+ TestUtil.AssertEqual(ChrW(charcode:=35), "#", "ChrW(charcode:=35)")
+
+ Exit Sub
+errorHandler:
+ TestUtil.ReportErrorHandler("verify_testCHRW", Err, Error$, Erl)
+End Sub
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index 1a2499cde2da..0bb572bbcd33 100644
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -200,10 +200,10 @@ constexpr Method aMethods[] = {
arg(u"Expression", SbxVARIANT),
{ u"Chr", SbxSTRING, 1 | FUNCTION_, SbRtl_Chr },
- arg(u"string", SbxINTEGER),
+ arg(u"charcode", SbxLONG),
{ u"ChrW", SbxSTRING, 1 | FUNCTION_ | COMPATONLY_, SbRtl_ChrW },
- arg(u"string", SbxINTEGER),
+ arg(u"charcode", SbxLONG),
{ u"CInt", SbxINTEGER, 1 | FUNCTION_, SbRtl_CInt },
arg(u"expression", SbxVARIANT),