Commit a651d9b9 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[2427] Check handling of origin in $INCLUDE

This is leftover from #2428, but it wasn't possible to handle then yet.
parent a8c08c6b
......@@ -443,6 +443,30 @@ TEST_F(MasterLoaderTest, originWithGarbage) {
checkARR("www.example.org");
}
// Test we can pass both file to include and the origin to switch
TEST_F(MasterLoaderTest, includeAndOrigin) {
// First, switch origin to something else, so we can check it is
// switched back.
const string include_string = "$ORIGIN www\n"
"@ 1H IN A 192.0.2.1\n"
// Then include the file with data and switch origin back
"$INCLUDE " TEST_DATA_SRCDIR "/example.org example.org.\n"
// Another RR to see the switch survives after we exit include
"www 1H IN A 192.0.2.1\n";
stringstream ss(include_string);
setLoader(ss, Name("example.org"), RRClass::IN(),
MasterLoader::MANY_ERRORS);
// Successfully load the data
loader_->load();
EXPECT_TRUE(loader_->loadedSucessfully());
EXPECT_TRUE(errors_.empty());
EXPECT_TRUE(warnings_.empty());
// And check it's the correct data
checkARR("www.example.org");
checkBasicRRs();
checkARR("www.example.org");
}
// Test the constructor rejects empty add callback.
TEST_F(MasterLoaderTest, emptyCallback) {
EXPECT_THROW(MasterLoader(TEST_DATA_SRCDIR "/example.org",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment