Fixed null key/value bug, added tests

This commit is contained in:
Jesse Beder
2009-07-30 06:49:09 +00:00
parent 382f1ba3c7
commit 7a89920441
8 changed files with 87 additions and 16 deletions

View File

@@ -247,5 +247,62 @@ namespace Test
return true;
}
bool NullBlockSeqEntry()
{
std::string input = "- hello\n-\n- world";
std::stringstream stream(input);
YAML::Parser parser(stream);
YAML::Node doc;
parser.GetNextDocument(doc);
std::string output;
doc[0] >> output;
if(output != "hello")
return false;
doc[1] >> output;
if(output != "~")
return false;
doc[2] >> output;
if(output != "world")
return false;
return true;
}
bool NullBlockMapKey()
{
std::string input = ": empty key";
std::stringstream stream(input);
YAML::Parser parser(stream);
YAML::Node doc;
parser.GetNextDocument(doc);
std::string output;
doc[YAML::Null] >> output;
if(output != "empty key")
return false;
return true;
}
bool NullBlockMapValue()
{
std::string input = "empty value:";
std::stringstream stream(input);
YAML::Parser parser(stream);
YAML::Node doc;
parser.GetNextDocument(doc);
std::string output;
doc["empty value"] >> output;
if(output != "~")
return false;
return true;
}
}
}