Commit 3b1f845a authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[2377] Warn on unexpected EOF after error

When there's an error, we expect there'll be EOLN somewhere, so we can
recover. Warn in case there's EOF.
parent c1299514
......@@ -204,6 +204,9 @@ MasterLoader::MasterLoaderImpl::loadIncremental(size_t count_limit) {
const MasterToken& token(lexer_.getNextToken());
switch (token.getType()) {
case MasterToken::END_OF_FILE:
callbacks_.warning(lexer_.getSourceName(),
lexer_.getSourceLine(),
"Unexpected end ond of file");
// TODO: Try pop in case this is not the only
// source
return (true);
......
......@@ -282,9 +282,8 @@ TEST_F(MasterLoaderTest, brokenZone) {
EXPECT_NO_THROW(loader_->load());
EXPECT_FALSE(loader_->loadedSucessfully());
EXPECT_EQ(1, errors_.size());
// FIXME: The invalid rdata generates a warning.
// And we may want to generate warning ourself here too.
// EXPECT_TRUE(warnings_.empty());
// The unexpected EOF warning
EXPECT_EQ(1, warnings_.size());
checkRR("example.org", RRType::SOA(), "ns1.example.org. "
"admin.example.org. 1234 3600 1800 2419200 7200");
EXPECT_TRUE(rrsets_.empty());
......
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