Browse Source

[2389] added test cases involving internal lexer error.

JINMEI Tatuya 12 years ago
parent
commit
38c66b9617

+ 5 - 0
src/lib/dns/tests/rdata_in_a_unittest.cc

@@ -82,6 +82,11 @@ TEST_F(Rdata_IN_A_Test, createFromText) {
 
     // a valid address surrounded by parentheses; only okay with lexer
     checkFromTextIN_A("(192.0.2.1)", true, false);
+
+    // input that would cause lexer-specific error; it's bad text as an
+    // address so should result in the string version, too.
+    checkFromText<in::A, InvalidRdataText, MasterLexer::LexerError>(
+        ")192.0.2.1", rdata_in_a);
 }
 
 TEST_F(Rdata_IN_A_Test, createFromWire) {

+ 5 - 0
src/lib/dns/tests/rdata_in_aaaa_unittest.cc

@@ -83,6 +83,11 @@ TEST_F(Rdata_IN_AAAA_Test, createFromText) {
 
     // a valid address surrounded by parentheses; only okay with lexer
     checkFromTextIN_AAAA("(2001:db8::1234)", true, false);
+
+    // input that would cause lexer-specific error; it's bad text as an
+    // address so should result in the string version, too.
+    checkFromText<in::AAAA, InvalidRdataText, MasterLexer::LexerError>(
+        ")2001:db8::1234", rdata_in_aaaa);
 }
 
 TEST_F(Rdata_IN_AAAA_Test, createFromWire) {