Fixed bug in parsing escaped newline (it was being clipped like a regular newline)

This commit is contained in:
Jesse Beder
2012-01-11 17:55:27 -06:00
parent 4e350e5808
commit 8906ae9a0d
2 changed files with 29 additions and 2 deletions

View File

@@ -892,6 +892,17 @@ namespace Test
return doc.to<int>() == 5;
}
bool QuotedNewline()
{
std::string input = "foo: \"\\n\"";
std::stringstream stream(input);
YAML::Parser parser(stream);
YAML::Node doc;
parser.GetNextDocument(doc);
return doc["foo"].to<std::string>() == "\n";
}
}
namespace {
@@ -1172,6 +1183,7 @@ namespace Test
RunParserTest(&Parser::NaN, "NaN", passed, total);
RunParserTest(&Parser::NonConstKey, "non const key", passed, total);
RunParserTest(&Parser::SingleChar, "single char", passed, total);
RunParserTest(&Parser::QuotedNewline, "quoted newline", passed, total);
RunEncodingTest(&EncodeToUtf8, false, "UTF-8, no BOM", passed, total);
RunEncodingTest(&EncodeToUtf8, true, "UTF-8 with BOM", passed, total);