@@ -52,6 +52,28 @@ TEST(ParserHelper_Tests, IgnoreItemIgnoresAssignedBracedItem)
5252 ASSERT_EQ (" More text" , std::string{buffer});
5353}
5454
55+ TEST (ParserHelper_Tests, IgnoreItemIgnoresMisquotedItem)
56+ {
57+ std::stringstream input{" = \\\" ignore_me\" More text" };
58+ input >> std::noskipws;
59+ commonItems::ignoreItem (" unused" , input);
60+
61+ char buffer[256 ];
62+ input.getline (buffer, sizeof buffer);
63+ ASSERT_EQ (" More text" , std::string{buffer});
64+ }
65+
66+ TEST (ParserHelper_Tests, IgnoreItemIgnoresMisquotedBracedItem)
67+ {
68+ std::stringstream input{" = { \\\" ignore_me\" } More text" };
69+ input >> std::noskipws;
70+ commonItems::ignoreItem (" unused" , input);
71+
72+ char buffer[256 ];
73+ input.getline (buffer, sizeof buffer);
74+ ASSERT_EQ (" More text" , std::string{buffer});
75+ }
76+
5577TEST (ParserHelper_Tests, IgnoreItemIgnoresAssignedBracedItemOnExistsEquals)
5678{
5779 std::stringstream input{" ?= { { ignore_me } } More text" };
@@ -867,6 +889,21 @@ TEST(ParserHelper_Tests, StringOfItemGetsStringAfterEquals)
867889}
868890
869891
892+ TEST (ParserHelper_Tests, StringOfItemHandlesMismatchedQuotes)
893+ {
894+ std::stringstream input;
895+ input >> std::noskipws;
896+ input << " = {\n " ;
897+ input << " \t foo = \" some junk\\\"\" \n " ;
898+ input << " \t bar = baz\n " ;
899+ input << " }" ;
900+
901+ const commonItems::stringOfItem theItem (input);
902+
903+ ASSERT_EQ (input.str (), theItem.getString ());
904+ }
905+
906+
870907TEST (ParserHelper_Tests, StringOfItemsConvertsItemsWithinBracesToStrings)
871908{
872909 std::stringstream input;
0 commit comments