4 Function doUnitTest() As String
7 doUnitTest
= TestUtil
.GetResult()
10 Sub verify_stringReplace()
11 On Error GoTo errorHandler
12 ' tdf#132389 - case-insensitive operation for non-ASCII characters
14 retStr
= Replace("ABCabc", "b", "*")
15 TestUtil
.AssertEqual(retStr
, "A*Ca*c", "case-insensitive ASCII: " & retStr
)
16 retStr
= Replace("АБВабв", "б", "*")
17 TestUtil
.AssertEqual(retStr
, "А*Ва*в", "case-insensitive non-ASCII: " & retStr
)
19 ' tdf#141045 - different length of search and replace string. It is important
20 ' that the search string starts with the original string in order to test the error.
21 ' Without the fix in place, the string index calculations result in a crash.
22 retStr
= Replace("a", "abc", "ab")
23 TestUtil
.AssertEqual(retStr
, "a", "different length of search and replace string: " & retStr
)
25 ' tdf#143081 - Without the fix in place, this test would have crashed here
26 retStr
= Replace("""Straße""", """", """)
27 TestUtil
.AssertEqual(retStr
, ""Straße"", "replace doesn't crash: " & retStr
)
29 ' tdf#142487 - replace of special unicode characters.
30 ' Without the fix in place, this test would have failed with:
33 retStr
= Replace("Straße", "e", "en")
34 TestUtil
.AssertEqual(retStr
, "Straßen", "special unicode character: " & retStr
)
38 TestUtil
.ReportErrorHandler("verify_stringReplace", Err
, Error$, Erl
)