Fixed bug with omitted keys/values in a flow map

This commit is contained in:
Jesse Beder
2009-09-02 21:39:57 +00:00
parent 0d41a7de7c
commit 873ad336f8
6 changed files with 49 additions and 3 deletions

View File

@@ -220,6 +220,42 @@ namespace Test
return true;
}
bool FlowMapWithOmittedKey()
{
std::string input = "{: omitted key}";
std::stringstream stream(input);
YAML::Parser parser(stream);
YAML::Node doc;
parser.GetNextDocument(doc);
std::string output;
doc[YAML::Null] >> output;
if(output != "omitted key")
return false;
return true;
}
bool FlowMapWithOmittedValue()
{
std::string input = "{a: b, c:, d:}";
std::stringstream stream(input);
YAML::Parser parser(stream);
YAML::Node doc;
parser.GetNextDocument(doc);
std::string output;
doc["a"] >> output;
if(output != "b")
return false;
if(!IsNull(doc["c"]))
return false;
if(!IsNull(doc["d"]))
return false;
return true;
}
bool QuotedSimpleKeys()
{
std::string KeyValue[3] = { "\"double\": double\n", "'single': single\n", "plain: plain\n" };