Benjamin Mahler created MESOS-4656:
--------------------------------------
Summary: strings::split behaves incorrectly when n=1
Key: MESOS-4656
URL: https://issues.apache.org/jira/browse/MESOS-4656
Project: Mesos
Issue Type: Bug
Components: stout
Reporter: Benjamin Mahler
Assignee: Benjamin Mahler
While looking at the patches for MESOS-3833, I noticed that the code for
strings::split behaves incorrectly for n=1 (maximum number of tokens).
Adding the following test case demonstrates the issue:
{code}
TEST(StringsTest, SplitNOne)
{
vector<string> tokens = strings::split("foo,bar,,,", ",", 1);
ASSERT_EQ(1u, tokens.size());
EXPECT_EQ("foo,bar,,,", tokens[0]);
}
{code}
This fails as follows:
{noformat}
[ RUN ] StringsTest.SplitNOne
../../../../3rdparty/libprocess/3rdparty/stout/tests/strings_tests.cpp:357:
Failure
Value of: tokens.size()
Actual: 5
Expected: 1u
Which is: 1
[ FAILED ] StringsTest.SplitNOne (0 ms)
{noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)