summaryrefslogtreecommitdiffstats
path: root/basic/qa/basic_coverage/test_string_replace.vb
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
commit940b4d1848e8c70ab7642901a68594e8016caffc (patch)
treeeb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /basic/qa/basic_coverage/test_string_replace.vb
parentInitial commit. (diff)
downloadlibreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz
libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'basic/qa/basic_coverage/test_string_replace.vb')
-rw-r--r--basic/qa/basic_coverage/test_string_replace.vb37
1 files changed, 37 insertions, 0 deletions
diff --git a/basic/qa/basic_coverage/test_string_replace.vb b/basic/qa/basic_coverage/test_string_replace.vb
new file mode 100644
index 000000000..99eafdba6
--- /dev/null
+++ b/basic/qa/basic_coverage/test_string_replace.vb
@@ -0,0 +1,37 @@
+Dim passCount As Integer
+Dim failCount As Integer
+Dim result As String
+
+Function doUnitTest() As String
+ result = verify_stringReplace()
+ If failCount <> 0 Or passCount = 0 Then
+ doUnitTest = 0
+ Else
+ doUnitTest = 1
+ End If
+End Function
+
+Function verify_stringReplace() As String
+ passCount = 0
+ failCount = 0
+
+ result = "Test Results" & Chr$(10) & "============" & Chr$(10)
+
+ ' tdf#132389 - case-insensitive operation for non-ASCII characters
+ retStr = Replace("ABCabc", "b", "*")
+ TestLog_ASSERT retStr, "A*Ca*c", "case-insensitive ASCII: " & retStr
+ retStr = Replace("АБВабв", "б", "*")
+ TestLog_ASSERT retStr, "А*Ва*в", "case-insensitive non-ASCII: " & retStr
+
+ result = result & Chr$(10) & "Tests passed: " & passCount & Chr$(10) & "Tests failed: " & failCount & Chr$(10)
+ verify_stringReplace = result
+End Function
+
+Sub TestLog_ASSERT(actual As Variant, expected As Variant, testName As String)
+ If expected = actual Then
+ passCount = passCount + 1
+ Else
+ result = result & Chr$(10) & "Failed: " & testName & " returned " & actual & ", expected " & expected
+ failCount = failCount + 1
+ End If
+End Sub