BIND 10 #2506: Specialized getNextToken interface for

BIND 10 Development do-not-reply at isc.org
Mon Dec 3 11:21:18 UTC 2012


#2506: Specialized getNextToken interface for
-------------------------------------+-------------------------------------
            Reporter:  vorner        |                        Owner:
                Type:  task          |  jinmei
            Priority:  medium        |                       Status:
           Component:  libdns++      |  reviewing
            Keywords:                |                    Milestone:
           Sensitive:  0             |  Sprint-20121204
         Sub-Project:  DNS           |                   Resolution:
Estimated Difficulty:  0             |                 CVSS Scoring:
         Total Hours:  0             |              Defect Severity:  N/A
                                     |  Feature Depending on Ticket:
                                     |  loadzone-ng
                                     |          Add Hours to Ticket:  0
                                     |                    Internal?:  0
-------------------------------------+-------------------------------------
Changes (by jelte):

 * owner:  jelte => jinmei


Comment:

 Changes look good, I just have a few small comments on the tests:

 master_lexer_unittests.cc:

 eolCheck() expects a particular sequence of tokens, so it'd be nice if
 this got a small comment (either pointing out which tests it is intended
 for or which tokens it should get, i.e. the two consecutive newlines)

 Regarding that, I think the 'skip the 2nd \n' can go into eolCheck :)

 Oh and one additional test could be for another bad number case, where
 initially it does look like a number (e.g. '123abc'), for instance

 {{{
 diff --git a/src/lib/dns/tests/master_lexer_unittest.cc
 b/src/lib/dns/tests/mast
 index b751da8..33266e8 100644
 --- a/src/lib/dns/tests/master_lexer_unittest.cc
 +++ b/src/lib/dns/tests/master_lexer_unittest.cc
 @@ -369,6 +369,7 @@ TEST_F(MasterLexerTest, getNextTokenNumber) {
      ss << "\n";
      ss << "4294967296 ";        // =2^32, out of range
      ss << "not-a-number ";
 +    ss << "123abc ";
      ss << "86400";
      lexer.pushSource(ss);

 @@ -391,6 +392,11 @@ TEST_F(MasterLexerTest, getNextTokenNumber) {
      // The unexpected string should have been "ungotten".  Re-read and
 skip it.
      EXPECT_EQ(MasterToken::STRING, lexer.getNextToken().getType());

 +    // Expecting a number, but see a string.
 +    lexerErrorCheck(lexer, MasterToken::NUMBER, MasterToken::BAD_NUMBER);
 +    // The unexpected string should have been "ungotten".  Re-read and
 skip it.
 +    EXPECT_EQ(MasterToken::STRING, lexer.getNextToken().getType());
 +
      // Unless we specify NUMBER, decimal number string should be
 recognized
      // as a string.
      EXPECT_EQ("86400",
 }}}

 (this does not necessarily test anything extra, but given the way tokens
 are recognized I do believe this is a potentially useful addition)

-- 
Ticket URL: <http://bind10.isc.org/ticket/2506#comment:7>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list