basic/qa/basic_coverage/test_chr_method.bas | 30 +++++++++++++++++++++++++++ basic/qa/cppunit/test_vba.cxx | 1 basic/qa/vba_tests/chr.vb | 3 ++ basic/qa/vba_tests/chrw.vb | 31 ++++++++++++++++++++++++++++ basic/source/runtime/stdobj.cxx | 4 +-- 5 files changed, 67 insertions(+), 2 deletions(-)
New commits: commit 35aa82ef1c8047087e7eb76fe5abccbe48fbac1e Author: Andreas Heinisch <andreas.heini...@yahoo.de> AuthorDate: Fri Jan 7 10:19:28 2022 +0100 Commit: Andreas Heinisch <andreas.heini...@yahoo.de> CommitDate: Sat Jan 8 11:48:32 2022 +0100 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.heini...@yahoo.de> Reviewed-by: Andreas Heinisch <andreas.heini...@yahoo.de> 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),