diff options
Diffstat (limited to 'comphelper/qa/string/test_string.cxx')
-rw-r--r-- | comphelper/qa/string/test_string.cxx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx index 2ce6f2cff1bb..790519d07839 100644 --- a/comphelper/qa/string/test_string.cxx +++ b/comphelper/qa/string/test_string.cxx @@ -49,6 +49,7 @@ public: void testNatural(); void testReplace(); void testRemove(); + void testStripStart(); void testToken(); void testDecimalStringToNumber(); void testIsdigitAsciiString(); @@ -62,6 +63,7 @@ public: CPPUNIT_TEST(testNatural); CPPUNIT_TEST(testReplace); CPPUNIT_TEST(testRemove); + CPPUNIT_TEST(testStripStart); CPPUNIT_TEST(testToken); CPPUNIT_TEST(testDecimalStringToNumber); CPPUNIT_TEST(testIsdigitAsciiString); @@ -430,6 +432,26 @@ void TestString::testRemove() CPPUNIT_ASSERT(aOut.isEmpty()); } +void TestString::testStripStart() +{ + ::rtl::OString aIn(RTL_CONSTASCII_STRINGPARAM("abc")); + ::rtl::OString aOut; + + aOut = ::comphelper::string::stripStart(aIn, 'b'); + CPPUNIT_ASSERT(aOut.equalsL(RTL_CONSTASCII_STRINGPARAM("abc"))); + + aOut = ::comphelper::string::stripStart(aIn, 'a'); + CPPUNIT_ASSERT(aOut.equalsL(RTL_CONSTASCII_STRINGPARAM("bc"))); + + aIn = rtl::OString(RTL_CONSTASCII_STRINGPARAM("aaa")); + aOut = ::comphelper::string::stripStart(aIn, 'a'); + CPPUNIT_ASSERT(aOut.isEmpty()); + + aIn = rtl::OString(RTL_CONSTASCII_STRINGPARAM("aba")); + aOut = ::comphelper::string::stripStart(aIn, 'a'); + CPPUNIT_ASSERT(aOut.equalsL(RTL_CONSTASCII_STRINGPARAM("ba"))); +} + void TestString::testToken() { ::rtl::OString aIn(RTL_CONSTASCII_STRINGPARAM("10.11.12")); |