Finished refactoring of simple keys so that they can refer to multiple tokens at a single level

This commit is contained in:
jbeder
2009-09-05 03:49:38 +00:00
parent a2f2ab8426
commit ba472cc9a3
7 changed files with 126 additions and 44 deletions

View File

@@ -407,6 +407,54 @@ namespace Test
return true;
}
bool AnchorInSimpleKey()
{
std::string input = "- &a b: c\n- *a";
std::stringstream stream(input);
YAML::Parser parser(stream);
YAML::Node doc;
parser.GetNextDocument(doc);
if(doc.size() != 2)
return false;
std::string output;
doc[0]["b"] >> output;
if(output != "c")
return false;
doc[1] >> output;
if(output != "b")
return false;
return true;
}
bool AliasAsSimpleKey()
{
std::string input = "- &a b\n- *a: c";
std::stringstream stream(input);
YAML::Parser parser(stream);
YAML::Node doc;
parser.GetNextDocument(doc);
if(doc.size() != 2)
return false;
std::string output;
doc[0] >> output;
if(output != "b")
return false;
doc[1]["b"] >> output;
if(output != "c")
return false;
return true;
}
bool ExplicitDoc()
{
std::string input = "---\n- one\n- two";