diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-07-31 17:14:23 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-07-31 18:38:18 (GMT) |
commit | b3e6f21953d5d4b55ab9ffde78e1a1ff2a59dad1 (patch) | |
tree | 5abcfac22759c56c53a4de9bdf6f7247bb079b07 /Swiften/Base/UnitTest | |
parent | aa60aa80d2d170a536c246ef6c221f92de7dd8ed (diff) | |
download | swift-contrib-b3e6f21953d5d4b55ab9ffde78e1a1ff2a59dad1.zip swift-contrib-b3e6f21953d5d4b55ab9ffde78e1a1ff2a59dad1.tar.bz2 |
Add String::split().
Diffstat (limited to 'Swiften/Base/UnitTest')
-rw-r--r-- | Swiften/Base/UnitTest/StringTest.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Swiften/Base/UnitTest/StringTest.cpp b/Swiften/Base/UnitTest/StringTest.cpp index 2fa9f54..1dd44fb 100644 --- a/Swiften/Base/UnitTest/StringTest.cpp +++ b/Swiften/Base/UnitTest/StringTest.cpp @@ -24,6 +24,7 @@ class StringTest : public CppUnit::TestFixture CPPUNIT_TEST(testReplaceAll_ConsecutiveChars); CPPUNIT_TEST(testReplaceAll_MatchingReplace); CPPUNIT_TEST(testGetLowerCase); + CPPUNIT_TEST(testSplit); CPPUNIT_TEST_SUITE_END(); public: @@ -148,6 +149,15 @@ class StringTest : public CppUnit::TestFixture CPPUNIT_ASSERT_EQUAL(String("abcd e"), testling.getLowerCase()); } + + void testSplit() { + std::vector<String> result = String("abc def ghi").split(' '); + + CPPUNIT_ASSERT_EQUAL(3, static_cast<int>(result.size())); + CPPUNIT_ASSERT_EQUAL(String("abc"), result[0]); + CPPUNIT_ASSERT_EQUAL(String("def"), result[1]); + CPPUNIT_ASSERT_EQUAL(String("ghi"), result[2]); + } }; CPPUNIT_TEST_SUITE_REGISTRATION(StringTest); |