Fixed assignment with an empty node (new API) - a segfault that only showed up in debuggable

This commit is contained in:
beder
2011-12-20 22:19:54 -06:00
parent 66980da9d2
commit 569a0461f2
2 changed files with 11 additions and 1 deletions

View File

@@ -279,6 +279,13 @@ namespace Test
YAML_ASSERT(!!node["foo"]);
return true;
}
TEST Reassign()
{
YAML::Node node = YAML::Load("foo");
node = YAML::Node();
return true;
}
}
void RunNodeTest(TEST (*test)(), const std::string& name, int& passed, int& total) {
@@ -324,6 +331,7 @@ namespace Test
RunNodeTest(&Node::TempMapVariableAlias, "temp map variable alias", passed, total);
RunNodeTest(&Node::Bool, "bool", passed, total);
RunNodeTest(&Node::AutoBoolConversion, "auto bool conversion", passed, total);
RunNodeTest(&Node::Reassign, "reassign", passed, total);
std::cout << "Node tests: " << passed << "/" << total << " passed\n";
return passed == total;