summaryrefslogtreecommitdiff
path: root/basic/qa
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2021-07-15 20:43:32 +0200
committerAndreas Heinisch <andreas.heinisch@yahoo.de>2021-07-16 09:29:16 +0200
commitafddd56a8049957b9c0e025992d47c04342dbb88 (patch)
tree2a9bc9cb134de253cfa4eee28dbfaac7952241a5 /basic/qa
parente7b632bc727413f399a4d0cbc2e92d90b04a3bf7 (diff)
tdf#139840 - Use utl::TextSearch to implement the InStr function
In addtion, fixed a crash if the start position is greater than the length of the string being searched. Change-Id: I9bcda1131324bdfac6957018e91b3a36dd2dc3d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118996 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Diffstat (limited to 'basic/qa')
-rw-r--r--basic/qa/basic_coverage/test_instr_method.bas6
-rw-r--r--basic/qa/vba_tests/instr.vb6
2 files changed, 12 insertions, 0 deletions
diff --git a/basic/qa/basic_coverage/test_instr_method.bas b/basic/qa/basic_coverage/test_instr_method.bas
index ff763cb4226c..9e4545bb3b44 100644
--- a/basic/qa/basic_coverage/test_instr_method.bas
+++ b/basic/qa/basic_coverage/test_instr_method.bas
@@ -18,6 +18,12 @@ Function doUnitTest as String
' tdf#139840 - case-insensitive operation for non-ASCII characters
If (InStr(1, "α", "Α", 1) <> 1) Then Exit Function
+ ' tdf#139840 - German Eszett is uppercased to a two-character 'SS'.
+ ' This test should fail after tdf#110003 has been fixed.
+ If (InStr(2, "Straße", "s", 1) <> 5) Then Exit Function
+
+ ' Start position is greater than the length of the string being searched.
+ If (InStr(2, "α", "Α", 1) <> 0) Then Exit Function
doUnitTest = "OK"
diff --git a/basic/qa/vba_tests/instr.vb b/basic/qa/vba_tests/instr.vb
index 3ced2a07c8ca..cda19712b296 100644
--- a/basic/qa/vba_tests/instr.vb
+++ b/basic/qa/vba_tests/instr.vb
@@ -32,6 +32,12 @@ Sub verify_testInStr()
' tdf#139840 - case-insensitive operation for non-ASCII characters
TestUtil.AssertEqual(InStr(1, "α", "Α", 1), 1, "InStr(1, ""α"", ""Α"", 1)")
+ ' tdf#139840 - German Eszett is uppercased to a two-character 'SS'.
+ ' This test should fail after tdf#110003 has been fixed.
+ TestUtil.AssertEqual(InStr(2, "Straße", "s", 1), 5, "InStr(2, ""Straße"", ""s"", 1)")
+
+ ' Start position is greater than the length of the string being searched.
+ TestUtil.AssertEqual(InStr(2, "α", "Α", 1), 0, "InStr(2, ""α"", ""Α"", 1)")
Exit Sub
errorHandler: