summaryrefslogtreecommitdiff
path: root/comphelper/qa
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-05-03 12:59:05 +0300
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-06-18 17:02:08 +0200
commit0d4dcf380033902fe4eb70425138e419fb711271 (patch)
treed1c7ddc3d62d7bc787e8b84d942ca5e0b333de39 /comphelper/qa
parentfbd80e546c51875ff310462312090abb84076b35 (diff)
add comphelper::string::split
Change-Id: Iccc989a786e8e7b8dca1996b635248d7bf7fc5d8
Diffstat (limited to 'comphelper/qa')
-rw-r--r--comphelper/qa/string/test_string.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx
index 97814da5fe4c..70998759e04f 100644
--- a/comphelper/qa/string/test_string.cxx
+++ b/comphelper/qa/string/test_string.cxx
@@ -43,6 +43,7 @@ public:
void testDecimalStringToNumber();
void testIsdigitAsciiString();
void testReverseString();
+ void testSplit();
CPPUNIT_TEST_SUITE(TestString);
CPPUNIT_TEST(testNatural);
@@ -55,6 +56,7 @@ public:
CPPUNIT_TEST(testDecimalStringToNumber);
CPPUNIT_TEST(testIsdigitAsciiString);
CPPUNIT_TEST(testReverseString);
+ CPPUNIT_TEST(testSplit);
CPPUNIT_TEST_SUITE_END();
};
@@ -394,6 +396,16 @@ void TestString::testReverseString()
CPPUNIT_ASSERT(aOut == "CBA");
}
+void TestString::testSplit()
+{
+ OUString aIn("CTRL+ALT+F1");
+ std::vector<OUString> aRet = ::comphelper::string::split(aIn, '+');
+ CPPUNIT_ASSERT_EQUAL(size_t(3), aRet.size());
+ CPPUNIT_ASSERT_EQUAL(OUString("CTRL"), aRet[0]);
+ CPPUNIT_ASSERT_EQUAL(OUString("ALT"), aRet[1]);
+ CPPUNIT_ASSERT_EQUAL(OUString("F1"), aRet[2]);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(TestString);
}