Skip to content

Commit ebf104c

Browse files
author
Pavol Droba
committed
test for empty string split added
[SVN r66221]
1 parent 3b76763 commit ebf104c

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

string/test/split_test.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ void iterator_test()
4040
string str1("xx-abc--xx-abb");
4141
string str2("Xx-abc--xX-abb-xx");
4242
string str3("xx");
43+
string strempty("");
4344
const char* pch1="xx-abc--xx-abb";
4445
vector<string> tokens;
4546
vector< vector<int> > vtokens;
@@ -123,6 +124,25 @@ void iterator_test()
123124
BOOST_CHECK( tokens[3]==string("xx") );
124125
BOOST_CHECK( tokens[4]==string("abb") );
125126

127+
split(
128+
tokens,
129+
str3,
130+
is_any_of(","),
131+
token_compress_off);
132+
133+
BOOST_REQUIRE( tokens.size()==1 );
134+
BOOST_CHECK( tokens[0]==string("xx") );
135+
136+
split(
137+
tokens,
138+
strempty,
139+
is_punct(),
140+
token_compress_off);
141+
142+
BOOST_REQUIRE( tokens.size()==1 );
143+
BOOST_CHECK( tokens[0]==string("") );
144+
145+
126146
find_iterator<string::iterator> fiter=make_find_iterator(str1, first_finder("xx"));
127147
BOOST_CHECK(equals(*fiter, "xx"));
128148
++fiter;

0 commit comments

Comments
 (0)