Fix operator bool() exception on zombie node

This commit is contained in:
Jesse Beder
2015-03-29 14:31:22 -05:00
parent 67e37d000a
commit 25b2ed0787
3 changed files with 12 additions and 4 deletions

View File

@@ -281,6 +281,13 @@ TEST(NodeTest, DefaultNodeStyle) {
EXPECT_EQ(EmitterStyle::Default, node.Style());
}
TEST(NodeTest, AccessNonexistentKeyOnConstNode) {
YAML::Node node;
node["3"] = "4";
const YAML::Node& other = node;
ASSERT_FALSE(other["5"]);
}
class NodeEmitterTest : public ::testing::Test {
protected:
void ExpectOutput(const std::string& output, const Node& node) {