|
|
@@ -78,23 +78,23 @@ TEST(TokenizerTest, CorrectlySplitsWhenEvenEscapes) {
|
|
|
TEST(TokenizerTest, QuotesAreDiscarded) {
|
|
|
std::string const input = R"(A,"B",C)";
|
|
|
std::vector<std::string> const expected{"A", "B", "C"};
|
|
|
- EXPECT_THAT(tokenizer(",", "\"")(input), expected);
|
|
|
+ EXPECT_THAT(tokenizer(",", {'"'})(input), expected);
|
|
|
}
|
|
|
|
|
|
TEST(TokenizerTest, QuotedTokensStickTogether) {
|
|
|
std::string const input = R"(A,"B,C")";
|
|
|
std::vector<std::string> const expected{"A", "B,C"};
|
|
|
- EXPECT_THAT(tokenizer(",", "\"")(input), expected);
|
|
|
+ EXPECT_THAT(tokenizer(",", {'"'})(input), expected);
|
|
|
}
|
|
|
|
|
|
-TEST(TokenizerTest, QuotedTokensAreAlwaysEscapable) {
|
|
|
+TEST(TokenizerTest, QuotedTokensAreEscapable) {
|
|
|
std::string const input = R"(A,"B\",C")";
|
|
|
std::vector<std::string> const expected{"A", "B\",C"};
|
|
|
- EXPECT_THAT(tokenizer(",", "\"")(input), expected);
|
|
|
+ EXPECT_THAT(tokenizer(",", {'"', "\\\""})(input), expected);
|
|
|
}
|
|
|
|
|
|
-TEST(TokenizerTest, QuotedTokensDontApplyOutOfFirstChar) {
|
|
|
+TEST(TokenizerTest, QuotesDontNeedToBeAtStartAndEnd) {
|
|
|
std::string const input = R"(A,B",C")";
|
|
|
- std::vector<std::string> const expected{"A", "B\"", "C\""};
|
|
|
- EXPECT_THAT(tokenizer(",", "\"")(input), expected);
|
|
|
+ std::vector<std::string> const expected{"A", "B,C"};
|
|
|
+ EXPECT_THAT(tokenizer(",", {'"', "\\\""})(input), expected);
|
|
|
}
|