Browse Source

[2497] Add missing testcase for AbstractRdataFactory::create() from lexer

Mukund Sivaraman 12 years ago
parent
commit
6921ae3d95
1 changed files with 25 additions and 0 deletions
  1. 25 0
      src/lib/dns/tests/rrparamregistry_unittest.cc

+ 25 - 0
src/lib/dns/tests/rrparamregistry_unittest.cc

@@ -24,6 +24,10 @@
 #include <dns/rdataclass.h>
 #include <dns/rrparamregistry.h>
 #include <dns/rrtype.h>
+#include <dns/master_loader.h>
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/bind.hpp>
 
 using namespace std;
 using namespace isc::dns;
@@ -153,4 +157,25 @@ TEST_F(RRParamRegistryTest, addRemoveFactory) {
                      RRType(test_type_code)));
 }
 
+void dummyCallback(const string&, size_t, const string&) {
+}
+
+TEST_F(RRParamRegistryTest, createFromLexer) {
+    boost::scoped_ptr<AbstractRdataFactory> rdf(new TestRdataFactory);
+
+    std::stringstream ss("192.168.0.1");
+    MasterLexer lexer;
+    lexer.pushSource(ss);
+
+    const MasterLoaderCallbacks::IssueCallback callback
+        (boost::bind(&dummyCallback, _1, _2, _3));
+    MasterLoaderCallbacks callbacks(callback, callback);
+    Name origin("example.org.");
+
+    const RdataPtr rdata = rdf->create(lexer, &origin,
+                                       MasterLoader::MANY_ERRORS,
+                                       callbacks);
+    EXPECT_EQ(0, in::A("192.168.0.1").compare(*rdata));
+}
+
 }