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

[2427] Origin handling in $INCLUDE

parent a651d9b9
...@@ -128,7 +128,12 @@ public: ...@@ -128,7 +128,12 @@ public:
if (name_tok.getType() == MasterToken::QSTRING || if (name_tok.getType() == MasterToken::QSTRING ||
name_tok.getType() == MasterToken::STRING) { name_tok.getType() == MasterToken::STRING) {
// TODO: Handle the origin. Once we complete #2427. // There's an optional name, meaning origin. Extract it
// and store.
const MasterToken::StringRegion&
name_string(name_tok.getStringRegion());
active_origin_ = Name(name_string.beg, name_string.len,
&active_origin_);
} else { } else {
// We return the newline there. This is because after we pop // We return the newline there. This is because after we pop
// the source, we want to call eatUntilEOL and this would // the source, we want to call eatUntilEOL and this would
......
...@@ -331,7 +331,7 @@ struct ErrorCase { ...@@ -331,7 +331,7 @@ struct ErrorCase {
{ "$INCLUDES " TEST_DATA_SRCDIR "/example.org", "Include too long" }, { "$INCLUDES " TEST_DATA_SRCDIR "/example.org", "Include too long" },
{ "$INCLUDE", "Missing include path" }, { "$INCLUDE", "Missing include path" },
{ "$INCLUDE /file/not/found", "Include file not found" }, { "$INCLUDE /file/not/found", "Include file not found" },
{ "$INCLUDE /file/not/found and here goes bunch of garbage", { "$INCLUDE /file/not/found example.org. and here goes bunch of garbage",
"Include file not found and garbage at the end of line" }, "Include file not found and garbage at the end of line" },
{ "$ORIGIN", "Missing origin name" }, { "$ORIGIN", "Missing origin name" },
{ "$ORIGIN invalid...name", "Invalid name for origin" }, { "$ORIGIN invalid...name", "Invalid name for origin" },
...@@ -411,7 +411,7 @@ TEST_F(MasterLoaderTest, includeWithGarbage) { ...@@ -411,7 +411,7 @@ TEST_F(MasterLoaderTest, includeWithGarbage) {
// Include an origin (example.org) because we expect it to be handled // Include an origin (example.org) because we expect it to be handled
// soon and we don't want it to break here. // soon and we don't want it to break here.
const string include_str("$INCLUDE " TEST_DATA_SRCDIR const string include_str("$INCLUDE " TEST_DATA_SRCDIR
"/example.org example.org bunch of other stuff\n" "/example.org example.org. bunch of other stuff\n"
"www 3600 IN AAAA 2001:db8::1\n"); "www 3600 IN AAAA 2001:db8::1\n");
stringstream zone_stream(include_str); stringstream zone_stream(include_str);
setLoader(zone_stream, Name("example.org."), RRClass::IN(), setLoader(zone_stream, Name("example.org."), RRClass::IN(),
......
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