|
@@ -158,6 +158,8 @@ TEST_F(MasterLoaderTest, include) {
|
|
|
};
|
|
|
for (const char** include = includes; *include != NULL; ++include) {
|
|
|
SCOPED_TRACE(*include);
|
|
|
+
|
|
|
+ clear();
|
|
|
// Prepare input source that has the include and some more data
|
|
|
// below (to see it returns back to the original source).
|
|
|
const string include_str = "$" + string(*include) + " " +
|
|
@@ -176,6 +178,26 @@ TEST_F(MasterLoaderTest, include) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// Test the source is correctly popped even after error
|
|
|
+TEST_F(MasterLoaderTest, popAfterError) {
|
|
|
+ const string include_str = "$include " TEST_DATA_SRCDIR
|
|
|
+ "/broken.zone\nwww 3600 IN AAAA 2001:db8::1\n";
|
|
|
+ stringstream ss(include_str);
|
|
|
+ // We don't test without MANY_ERRORS, we want to see what happens
|
|
|
+ // after the error.
|
|
|
+ setLoader(ss, Name("example.org."), RRClass::IN(),
|
|
|
+ MasterLoader::MANY_ERRORS);
|
|
|
+
|
|
|
+ loader_->load();
|
|
|
+ EXPECT_FALSE(loader_->loadedSucessfully());
|
|
|
+ EXPECT_EQ(1, errors_.size()); // For the broken RR
|
|
|
+ EXPECT_EQ(1, warnings_.size()); // For missing EOLN
|
|
|
+
|
|
|
+ // The included file doesn't contain anything usable, but the
|
|
|
+ // line after the include should be there.
|
|
|
+ checkRR("www.example.org", RRType::AAAA(), "2001:db8::1");
|
|
|
+}
|
|
|
+
|
|
|
// Check it works the same when created based on a stream, not filename
|
|
|
TEST_F(MasterLoaderTest, streamConstructor) {
|
|
|
stringstream zone_stream(prepareZone("", true));
|