BIND 10 trac2373, updated. 843eaa0b842b335139c75f96275edc467bf6d7e6 [2373] added a test for qstring: confirm separators are regarded as part of str

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Nov 19 03:12:04 UTC 2012


The branch, trac2373 has been updated
       via  843eaa0b842b335139c75f96275edc467bf6d7e6 (commit)
       via  c3d39b62623067beab9d99c091f0aeba10c3f833 (commit)
      from  ac107fab886b1adb0085ade12b16d27caa0e6cb5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 843eaa0b842b335139c75f96275edc467bf6d7e6
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Mon Nov 19 12:10:51 2012 +0900

    [2373] added a test for qstring: confirm separators are regarded as part of str

commit c3d39b62623067beab9d99c091f0aeba10c3f833
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Mon Nov 19 12:05:21 2012 +0900

    [2373] additional test for escaped str: check escaped \ doesn't confuse lexer.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/dns/tests/master_lexer_state_unittest.cc |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/tests/master_lexer_state_unittest.cc b/src/lib/dns/tests/master_lexer_state_unittest.cc
index f64ab79..615e49e 100644
--- a/src/lib/dns/tests/master_lexer_state_unittest.cc
+++ b/src/lib/dns/tests/master_lexer_state_unittest.cc
@@ -353,11 +353,21 @@ TEST_F(MasterLexerStateTest, stringEscape) {
     EXPECT_EQ(&s_string, State::start(lexer, common_options));
     EXPECT_EQ(s_null, s_string.handle(lexer)); // recognize str, see ' ' in mid
     stringTokenCheck("escaped\\\\", s_string.getToken(lexer));
+
+    // Confirm the word that follows the escaped '\' is correctly recognized.
+    EXPECT_EQ(&s_string, State::start(lexer, common_options));
+    EXPECT_EQ(s_null, s_string.handle(lexer)); // recognize str, see ' ' at end
+    stringTokenCheck("backslash", s_string.getToken(lexer));
 }
 
 TEST_F(MasterLexerStateTest, quotedString) {
     ss << "\"ignore-quotes\"\n";
-    ss << "\"quoted string\" ";
+    ss << "\"quoted string\" "; // space is part of the qstring
+    // also check other separator characters. note that \r doesn't cause
+    // UNBALANCED_QUOTES.  Not sure if it's intentional, but that's how the
+    // BIND 9 version works, so we follow it (it should be too minor to matter
+    // in practice anyway)
+    ss << "\"quoted()\t\rstring\" ";
     ss << "\"escape\\ in quote\" ";
     ss << "\"escaped\\\"\" ";
     ss << "\"escaped backslash\\\\\" ";
@@ -379,6 +389,11 @@ TEST_F(MasterLexerStateTest, quotedString) {
     EXPECT_EQ(s_null, s_qstring.handle(lexer));
     stringTokenCheck("quoted string", s_string.getToken(lexer), true);
 
+    // Also checks other separator characters within a qstring
+    EXPECT_EQ(&s_qstring, State::start(lexer, options));
+    EXPECT_EQ(s_null, s_qstring.handle(lexer));
+    stringTokenCheck("quoted()\t\rstring", s_string.getToken(lexer), true);
+
     // escape character mostly doesn't have any effect in the qstring
     // processing
     EXPECT_EQ(&s_qstring, State::start(lexer, options));



More information about the bind10-changes mailing list