From: Tomek Mrugalski Date: Thu, 8 Dec 2016 12:20:28 +0000 (+0100) Subject: [5036] Unit-tests cleanup. X-Git-Tag: trac5085_base~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=78659fde90a28b5d5be234a5cbeaa5a7782e87ee;p=thirdparty%2Fkea.git [5036] Unit-tests cleanup. --- diff --git a/src/bin/dhcp6/dhcp6_parser.yy b/src/bin/dhcp6/dhcp6_parser.yy index 2bf1cc7cd7..9b0a50398d 100644 --- a/src/bin/dhcp6/dhcp6_parser.yy +++ b/src/bin/dhcp6/dhcp6_parser.yy @@ -33,7 +33,6 @@ using namespace std; %code { #include - } @@ -136,6 +135,26 @@ using namespace std; DHCP_DDNS "dhcp-ddns" + /// @todo: Implement proper parsing for those parameters in Dhcp6/dhcp-ddns/*. + /// This should be part of the #5043 ticket. Listing the keywords here for + /// completeness. + + // These are tokens defined in Dhcp6/dhcp-ddns/* + // They're not + // ENABLE_UPDATES "enable-updates" + // SERVER_IP "server-ip" + // SENDER_IP "sender-ip" + // SENDER_PORT "sender-port" + // MAX_QUEUE_SIZE "max-queue-size" + // NCR_PROTOCOL "ncr-protocol" + // NCR_FORMAT "ncr-format" + // ALWAYS_INCLUDE_FQDN "always-include-fqdn" + // OVERRDIDE_NO_UPDATE "override-no-update" + // OVERRDIDE_CLIENT_UPDATE "override-client-update" + // REPLACE_CLIENT_NAME "replace-client-name" + // GENERATED_PREFIX "generated-prefix" + // QUALIFYING_SUFFIX "qualifying-suffix" + LOGGING "Logging" LOGGERS "loggers" OUTPUT_OPTIONS "output_options" @@ -536,7 +555,7 @@ host_reservation_identifiers: HOST_RESERVATION_IDENTIFIERS { ElementPtr l(new ListElement(ctx.loc2pos(@1))); ctx.stack_.back()->set("host-reservation-identifiers", l); ctx.stack_.push_back(l); - ctx.enter(ctx.HOST_RESERVATION_IDENTIFIERS); + ctx.enter(ctx.HOST_RESERVATION_IDENTIFIERS); } COLON LSQUARE_BRACKET host_reservation_identifiers_list RSQUARE_BRACKET { ctx.stack_.pop_back(); ctx.leave(); @@ -611,7 +630,7 @@ library: LIBRARY { } COLON STRING { ElementPtr lib(new StringElement($4, ctx.loc2pos(@4))); ctx.stack_.back()->set("library", lib); - ctx.leave(); + ctx.leave(); }; parameters: PARAMETERS { diff --git a/src/bin/dhcp6/tests/kea_controller_unittest.cc b/src/bin/dhcp6/tests/kea_controller_unittest.cc index 9f65ed2372..dc2fc57c9c 100644 --- a/src/bin/dhcp6/tests/kea_controller_unittest.cc +++ b/src/bin/dhcp6/tests/kea_controller_unittest.cc @@ -393,7 +393,7 @@ TEST_F(JSONFileBackendTest, recursiveInclude) { writeFile(TEST_FILE, config_recursive_include); writeFile(TEST_INCLUDE, include); - + // Now initialize the server boost::scoped_ptr srv; diff --git a/src/bin/dhcp6/tests/parser_unittest.cc b/src/bin/dhcp6/tests/parser_unittest.cc index a797469569..f1919cd25a 100644 --- a/src/bin/dhcp6/tests/parser_unittest.cc +++ b/src/bin/dhcp6/tests/parser_unittest.cc @@ -254,7 +254,8 @@ void testError(const std::string& txt, try { Parser6Context ctx; ConstElementPtr parsed = ctx.parseString(txt, parser_type); - FAIL() << "Expected Dhcp6ParseError but nothing was raised"; + FAIL() << "Expected Dhcp6ParseError but nothing was raised (expected: " + << msg << ")"; } catch (const Dhcp6ParseError& ex) { EXPECT_EQ(msg, ex.what()); @@ -277,28 +278,22 @@ TEST(ParserTest, errors) { // comments testError("# nothing\n", Parser6Context::PARSER_JSON, - ":2.1: syntax error, unexpected end of file, " - "expecting {"); + ":2.1: syntax error, unexpected end of file"); testError(" #\n", Parser6Context::PARSER_JSON, - ":2.1: syntax error, unexpected end of file, " - "expecting {"); + ":2.1: syntax error, unexpected end of file"); testError("// nothing\n", Parser6Context::PARSER_JSON, - ":2.1: syntax error, unexpected end of file, " - "expecting {"); + ":2.1: syntax error, unexpected end of file"); testError("/* nothing */\n", Parser6Context::PARSER_JSON, - ":2.1: syntax error, unexpected end of file, " - "expecting {"); + ":2.1: syntax error, unexpected end of file"); testError("/* no\nthing */\n", Parser6Context::PARSER_JSON, - ":3.1: syntax error, unexpected end of file, " - "expecting {"); + ":3.1: syntax error, unexpected end of file"); testError("/* no\nthing */\n\n", Parser6Context::PARSER_JSON, - ":4.1: syntax error, unexpected end of file, " - "expecting {"); + ":4.1: syntax error, unexpected end of file"); testError("/* nothing\n", Parser6Context::PARSER_JSON, "Comment not closed. (/* in line 1"); @@ -333,15 +328,15 @@ TEST(ParserTest, errors) { // numbers testError("123", - Parser6Context::PARSER_JSON, + Parser6Context::PARSER_DHCP6, ":1.1-3: syntax error, unexpected integer, " "expecting {"); testError("-456", - Parser6Context::PARSER_JSON, + Parser6Context::PARSER_DHCP6, ":1.1-4: syntax error, unexpected integer, " "expecting {"); testError("-0001", - Parser6Context::PARSER_JSON, + Parser6Context::PARSER_DHCP6, ":1.1-5: syntax error, unexpected integer, " "expecting {"); testError("1234567890123456789012345678901234567890", @@ -350,7 +345,7 @@ TEST(ParserTest, errors) { "1234567890123456789012345678901234567890" " to an integer."); testError("-3.14e+0", - Parser6Context::PARSER_JSON, + Parser6Context::PARSER_DHCP6, ":1.1-8: syntax error, unexpected floating point, " "expecting {"); testError("1e50000", @@ -360,7 +355,7 @@ TEST(ParserTest, errors) { // strings testError("\"aabb\"", - Parser6Context::PARSER_JSON, + Parser6Context::PARSER_DHCP6, ":1.1-6: syntax error, unexpected constant string, " "expecting {"); testError("{ \"aabb\"err", @@ -373,7 +368,7 @@ TEST(ParserTest, errors) { Parser6Context::PARSER_JSON, ":1.1-6: Invalid control in \"a\n\tb\""); testError("\"a\\n\\tb\"", - Parser6Context::PARSER_JSON, + Parser6Context::PARSER_DHCP6, ":1.1-8: syntax error, unexpected constant string, " "expecting {"); testError("\"a\\x01b\"", @@ -402,7 +397,7 @@ TEST(ParserTest, errors) { // want a map testError("[]\n", - Parser6Context::PARSER_JSON, + Parser6Context::PARSER_DHCP6, ":1.1: syntax error, unexpected [, " "expecting {"); testError("[]\n",