summaryrefslogtreecommitdiff
path: root/comphelper/qa
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-11-16 22:19:58 +0000
committerCaolán McNamara <caolanm@redhat.com>2011-11-17 23:04:10 +0000
commitdca04e236193db7de908aad746fd4539e78eb428 (patch)
tree9808f843924944a740ca8037094d4d5c4553bbc8 /comphelper/qa
parentc4927a1b76b728b2208c29d09dbf54e70bb26e13 (diff)
add a StringUtils-alike remove (can replace EraseAllChars)
Diffstat (limited to 'comphelper/qa')
-rw-r--r--comphelper/qa/string/test_string.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx
index a290cb7c5e93..110638164506 100644
--- a/comphelper/qa/string/test_string.cxx
+++ b/comphelper/qa/string/test_string.cxx
@@ -48,6 +48,7 @@ public:
void testSearchAndReplaceAsciiL();
void testNatural();
void testReplace();
+ void testRemove();
void testToken();
void testDecimalStringToNumber();
void testIsdigitAsciiString();
@@ -59,6 +60,7 @@ public:
CPPUNIT_TEST(testSearchAndReplaceAsciiL);
CPPUNIT_TEST(testNatural);
CPPUNIT_TEST(testReplace);
+ CPPUNIT_TEST(testRemove);
CPPUNIT_TEST(testToken);
CPPUNIT_TEST(testDecimalStringToNumber);
CPPUNIT_TEST(testIsdigitAsciiString);
@@ -395,6 +397,20 @@ void TestString::testReplace()
RTL_CONSTASCII_STRINGPARAM("aaafooaaafoobbb")));
}
+void TestString::testRemove()
+{
+ ::rtl::OString aIn(RTL_CONSTASCII_STRINGPARAM("abc"));
+ ::rtl::OString aOut;
+
+ aOut = ::comphelper::string::remove(aIn, 'b');
+ CPPUNIT_ASSERT(aOut.equalsL(RTL_CONSTASCII_STRINGPARAM("ac")));
+
+ aIn = rtl::OString(RTL_CONSTASCII_STRINGPARAM("aaa"));
+
+ aOut = ::comphelper::string::remove(aIn, 'a');
+ CPPUNIT_ASSERT(aOut.isEmpty());
+}
+
void TestString::testToken()
{
::rtl::OString aIn(RTL_CONSTASCII_STRINGPARAM("10.11.12"));