aboutsummaryrefslogtreecommitdiffstats
path: root/test/DivideStringTest.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-12-04 23:05:44 +0100
committerMax Kellermann <max@duempel.org>2014-12-04 23:05:44 +0100
commit4b70f9d213e8cb71bc225a73494625e31dfaa721 (patch)
tree3f81136416b0b88e917a08e26d32326a839e0efd /test/DivideStringTest.hxx
parent79d2d1c201babcbbfa1337295d42feebaebb6021 (diff)
downloadmpd-4b70f9d213e8cb71bc225a73494625e31dfaa721.tar.gz
mpd-4b70f9d213e8cb71bc225a73494625e31dfaa721.tar.xz
mpd-4b70f9d213e8cb71bc225a73494625e31dfaa721.zip
util/DivideString: add option "strip"
Diffstat (limited to 'test/DivideStringTest.hxx')
-rw-r--r--test/DivideStringTest.hxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/DivideStringTest.hxx b/test/DivideStringTest.hxx
index 83c54dc56..f6c01bdde 100644
--- a/test/DivideStringTest.hxx
+++ b/test/DivideStringTest.hxx
@@ -15,6 +15,7 @@ class DivideStringTest : public CppUnit::TestFixture {
CPPUNIT_TEST(TestBasic);
CPPUNIT_TEST(TestEmpty);
CPPUNIT_TEST(TestFail);
+ CPPUNIT_TEST(TestStrip);
CPPUNIT_TEST_SUITE_END();
public:
@@ -41,4 +42,13 @@ public:
const DivideString ds(input, '.');
CPPUNIT_ASSERT(!ds.IsDefined());
}
+
+ void TestStrip() {
+ constexpr char input[] = " foo\t.\nbar\r";
+ const DivideString ds(input, '.', true);
+ CPPUNIT_ASSERT(ds.IsDefined());
+ CPPUNIT_ASSERT(!ds.IsEmpty());
+ CPPUNIT_ASSERT_EQUAL(0, strcmp(ds.GetFirst(), "foo"));
+ CPPUNIT_ASSERT_EQUAL(input + 7, ds.GetSecond());
+ }
};