summaryrefslogtreecommitdiffstats
path: root/src/lib/dns/tests/rdata_unittest.cc
diff options
context:
space:
mode:
authorJINMEI Tatuya <jinmei@isc.org>2012-11-30 07:30:56 +0100
committerJINMEI Tatuya <jinmei@isc.org>2012-12-01 04:41:13 +0100
commitb9f1eefe7e7040db4841e75a38b6a9cd1511eb59 (patch)
treebc1220e669f2bdaa952e7d541f4072ca27f1e8be /src/lib/dns/tests/rdata_unittest.cc
parent[2382] ungetToken EOL/EOF in the backend factories. (diff)
downloadkea-b9f1eefe7e7040db4841e75a38b6a9cd1511eb59.tar.xz
kea-b9f1eefe7e7040db4841e75a38b6a9cd1511eb59.zip
[2382] Consume to end of line / file in createRdata().
Diffstat (limited to 'src/lib/dns/tests/rdata_unittest.cc')
-rw-r--r--src/lib/dns/tests/rdata_unittest.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/lib/dns/tests/rdata_unittest.cc b/src/lib/dns/tests/rdata_unittest.cc
index bc91f7ad0d..08d9628d19 100644
--- a/src/lib/dns/tests/rdata_unittest.cc
+++ b/src/lib/dns/tests/rdata_unittest.cc
@@ -82,6 +82,30 @@ createRdataUsingLexer(const RRType& rrtype, const RRClass& rrclass,
} // end of namespace isc::dns::rdata::test
+// Test class/type-independent behavior of createRdata().
+TEST_F(RdataTest, createRdataWithLexer) {
+ const generic::NS ns_rdata("ns.example.com.");
+ const in::AAAA aaaa_rdata("2001:db8::1");
+
+ stringstream ss;
+ ss << ns_rdata.toText() << "\n"; // valid case
+ ss << aaaa_rdata.toText() << " extra-token\n"; // extra token
+ lexer.pushSource(ss);
+
+ const MasterLoaderCallbacks::IssueCallback callback
+ (boost::bind(&test::dummyCallback, _1, _2, _3));
+ MasterLoaderCallbacks callbacks(callback, callback);
+ ConstRdataPtr rdata = createRdata(RRType::NS(), RRClass::IN(), lexer, NULL,
+ MasterLoader::MANY_ERRORS, callbacks);
+ EXPECT_EQ(0, ns_rdata.compare(*rdata));
+
+#ifdef notyet
+ rdata = createRdata(RRType::AAAA(), RRClass::IN(), lexer, NULL,
+ MasterLoader::MANY_ERRORS, callbacks);
+ EXPECT_EQ(0, aaaa_rdata.compare(*rdata));
+#endif
+}
+
}
}
}