Files
libreoffice/basic/qa/basic_coverage/test_string_method.bas
Alain Romedenne fd19bc83cf tdf#141474 tdf#151901 BASIC functions argument names do not match that of VBA
Basic function argument names can be used either by position either by name, keyword arguments ae called 'named arguments' in VBA
- VBA doc:
https://learn.microsoft.com/en-us/office/vba/language/concepts/getting-started/understanding-named-arguments-and-optional-arguments
- libO Basic function signatures:
https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03090401.html?DbPAR=BASIC#bm_id3154422

This patch attempts to correct - all in one - malformed keyword names in BASIC function signatures.

It reflects keyword arguments usage inside QA BASIC unit tests.

In the end Online help pages may incorporate such practice.

Change-Id: Iab0c92b2c152d2564662e51e68f1f736b8deefd0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145720
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2023-02-26 16:14:47 +00:00

31 lines
1.2 KiB
QBasic

' 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
Dim failedAssertion As Boolean, messages As String
Function doUnitTest ' String(Number As Long, Character As String)
assert(String(3, "H")= "HHH", "String(3, ""H"") is not ""HHH""")
assert(String(5.8, "à")= "àààààà", "String(5.8, ""à"") is not ""àààààà""")
assert(String(Number:=3.45, Character:="test")="ttt", "String(Number:=3.45, Character:=""test"") is not ""ttt""")
assert(String(Character:="☺😎", Number:=7)= "☺☺☺☺☺☺☺", "String(Character:=""☺😎"", Number:=7) is not ""☺☺☺☺☺☺☺""")
If FailedAssertion Then
doUnitTest = "test_string_method.vb failed" + messages
Exit Function
EndIf
doUnitTest = "OK" ' All checks passed
End Function
Sub assert(expression As Boolean, errMessage As String)
if ( Not expression ) Then
messages = messages + Chr(10) + ErrMessage
failedAssertion = True
EndIf
End Sub