diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-06-25 08:52:08 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-06-25 08:52:37 +0200 |
commit | f7a7a9dd84d1cd8b49d59e1fb1853ea7e9f40edf (patch) | |
tree | 6f4d91d99d9cfef5035a4a1e5b42097e0df119f6 /sal/qa | |
parent | 0e2db2dd3413d760afaa4cfab4c7c224222b949a (diff) |
Do not forget to actually set newStr to an empty string
Change-Id: I745b09d8a248f08afdd3387f4cfcf69d71ec3c39
Diffstat (limited to 'sal/qa')
-rw-r--r-- | sal/qa/rtl/strings/test_strings_replace.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sal/qa/rtl/strings/test_strings_replace.cxx b/sal/qa/rtl/strings/test_strings_replace.cxx index 0d47c3e6f4c5..02054c1d8028 100644 --- a/sal/qa/rtl/strings/test_strings_replace.cxx +++ b/sal/qa/rtl/strings/test_strings_replace.cxx @@ -20,6 +20,7 @@ namespace { +OUString s_empty; OUString s_bar("bar"); OUString s_bars("bars"); OUString s_foo("foo"); @@ -176,6 +177,9 @@ void Test::ustringReplaceFirstAsciiL() { rtl::OUString("foobarfoo").replaceFirst("bar", s_other, &n)); CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), n); } + + CPPUNIT_ASSERT_EQUAL( + rtl::OUString(), rtl::OUString("xa").replaceFirst("xa", s_empty)); } void Test::ustringReplaceFirstToAsciiL() { @@ -210,6 +214,9 @@ void Test::ustringReplaceFirstToAsciiL() { rtl::OUString("foobarfoo").replaceFirst(s_bar, "other", &n)); CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), n); } + + CPPUNIT_ASSERT_EQUAL( + rtl::OUString(), rtl::OUString("xa").replaceFirst(s_xa, "")); } void Test::ustringReplaceFirstAsciiLAsciiL() { @@ -249,6 +256,9 @@ void Test::ustringReplaceFirstAsciiLAsciiL() { replaceFirst("bar", "other", &n))); CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), n); } + + CPPUNIT_ASSERT_EQUAL( + rtl::OUString(), rtl::OUString("xa").replaceFirst("xa", "")); } void Test::ustringReplaceAll() { @@ -277,6 +287,9 @@ void Test::ustringReplaceAllAsciiL() { CPPUNIT_ASSERT_EQUAL( rtl::OUString("xxa"), rtl::OUString("xaa").replaceAll("xa", s_xx)); + + CPPUNIT_ASSERT_EQUAL( + rtl::OUString(), rtl::OUString("xa").replaceAll("xa", s_empty)); } void Test::ustringReplaceAllToAsciiL() { @@ -291,6 +304,9 @@ void Test::ustringReplaceAllToAsciiL() { CPPUNIT_ASSERT_EQUAL( rtl::OUString("xxa"), rtl::OUString("xaa").replaceAll(s_xa, "xx")); + + CPPUNIT_ASSERT_EQUAL( + rtl::OUString(), rtl::OUString("xa").replaceAll(s_xa, "")); } void Test::ustringReplaceAllAsciiLAsciiL() { @@ -308,6 +324,9 @@ void Test::ustringReplaceAllAsciiLAsciiL() { rtl::OUString("xxa"), (rtl::OUString("xaa"). replaceAll("xa", "xx"))); + + CPPUNIT_ASSERT_EQUAL( + rtl::OUString(), rtl::OUString("xa").replaceAll("xa", "")); } } |