Unit tests for different quotes combinations.
Co-authored-by: ldo2 <ldo2.msiu@gmail.com>
This commit is contained in:
parent
9a2366a1c7
commit
07d343eed8
1 changed files with 31 additions and 0 deletions
|
@ -180,6 +180,37 @@ TEST_CASE("Read quoted empty values")
|
|||
CHECK_EQ(res[0], "");
|
||||
CHECK_EQ(res[1], "");
|
||||
}
|
||||
TEST_CASE("Read quoted quote")
|
||||
{
|
||||
const auto res = CsvParser::split_record(",\"\"\"\"");
|
||||
REQUIRE_EQ(res.size(), 2);
|
||||
CHECK_EQ(res[0], "");
|
||||
CHECK_EQ(res[1], "\"");
|
||||
}
|
||||
|
||||
TEST_CASE("Read quoted double quote")
|
||||
{
|
||||
const auto res = CsvParser::split_record(",\"\"\"\"\"\"");
|
||||
REQUIRE_EQ(res.size(), 2);
|
||||
CHECK_EQ(res[0], "");
|
||||
CHECK_EQ(res[1], "\"\"");
|
||||
}
|
||||
|
||||
TEST_CASE("Read quoted values with quotes in begin")
|
||||
{
|
||||
const auto res = CsvParser::split_record(",\"\"\"Name\"\" and some other\"");
|
||||
REQUIRE_EQ(res.size(), 2);
|
||||
CHECK_EQ(res[0], "");
|
||||
CHECK_EQ(res[1], "\"Name\" and some other");
|
||||
}
|
||||
|
||||
TEST_CASE("Read quoted values with quotes at end")
|
||||
{
|
||||
const auto res = CsvParser::split_record(",\"Text and \"\"Name\"\"\"");
|
||||
REQUIRE_EQ(res.size(), 2);
|
||||
CHECK_EQ(res[0], "");
|
||||
CHECK_EQ(res[1], "Text and \"Name\"");
|
||||
}
|
||||
TEST_SUITE_END();
|
||||
|
||||
TEST_SUITE_BEGIN("Read & write");
|
||||
|
|
Loading…
Add table
Reference in a new issue