From: Marcin Siodelski Date: Mon, 16 Jan 2023 21:15:19 +0000 (+0100) Subject: [#2688] Fixed failing parser test X-Git-Tag: Kea-2.2.1~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b0677bd5ec48d7d433a8149ef58743b0407ad91;p=thirdparty%2Fkea.git [#2688] Fixed failing parser test --- diff --git a/src/bin/agent/tests/parser_unittests.cc b/src/bin/agent/tests/parser_unittests.cc index 2b35ac62c0..d129291beb 100644 --- a/src/bin/agent/tests/parser_unittests.cc +++ b/src/bin/agent/tests/parser_unittests.cc @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -37,7 +38,11 @@ namespace test { void compareJSON(ConstElementPtr a, ConstElementPtr b) { ASSERT_TRUE(a); ASSERT_TRUE(b); - EXPECT_EQ(a->str(), b->str()); + EXPECT_EQ(a->str(), b->str()) +#ifdef HAVE_CREATE_UNIFIED_DIFF + << "\nDiff:\n" << generateDiff(prettyPrint(a), prettyPrint(b)) << "\n" +#endif + ; } /// @brief Tests if the input string can be parsed with specific parser diff --git a/src/bin/d2/tests/parser_unittest.cc b/src/bin/d2/tests/parser_unittest.cc index 910051172a..4635a3bf97 100644 --- a/src/bin/d2/tests/parser_unittest.cc +++ b/src/bin/d2/tests/parser_unittest.cc @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -38,7 +39,11 @@ namespace test { void compareJSON(ConstElementPtr a, ConstElementPtr b) { ASSERT_TRUE(a); ASSERT_TRUE(b); - EXPECT_EQ(a->str(), b->str()); + EXPECT_EQ(a->str(), b->str()) +#ifdef HAVE_CREATE_UNIFIED_DIFF + << "\nDiff:\n" << generateDiff(prettyPrint(a), prettyPrint(b)) << "\n" +#endif + ; } /// @brief Tests if the input string can be parsed with specific parser diff --git a/src/bin/dhcp4/tests/parser_unittest.cc b/src/bin/dhcp4/tests/parser_unittest.cc index 9a7e0db995..e6b8c4ce2a 100644 --- a/src/bin/dhcp4/tests/parser_unittest.cc +++ b/src/bin/dhcp4/tests/parser_unittest.cc @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -37,7 +38,11 @@ namespace test { void compareJSON(ConstElementPtr a, ConstElementPtr b) { ASSERT_TRUE(a); ASSERT_TRUE(b); - EXPECT_EQ(a->str(), b->str()); + EXPECT_EQ(a->str(), b->str()) +#ifdef HAVE_CREATE_UNIFIED_DIFF + << "\nDiff:\n" << generateDiff(prettyPrint(a), prettyPrint(b)) << "\n" +#endif + ; } /// @brief Tests if the input string can be parsed with specific parser diff --git a/src/bin/dhcp6/dhcp6_parser.yy b/src/bin/dhcp6/dhcp6_parser.yy index 6a9c50e80e..e0609e1def 100644 --- a/src/bin/dhcp6/dhcp6_parser.yy +++ b/src/bin/dhcp6/dhcp6_parser.yy @@ -1038,7 +1038,7 @@ connect_timeout: CONNECT_TIMEOUT COLON INTEGER { read_timeout: READ_TIMEOUT COLON INTEGER { ctx.unique("read-timeout", ctx.loc2pos(@1)); ElementPtr n(new IntElement($3, ctx.loc2pos(@3))); - ctx.stack_.back()->set("connect-timeout", n); + ctx.stack_.back()->set("read-timeout", n); }; write_timeout: WRITE_TIMEOUT COLON INTEGER { diff --git a/src/bin/dhcp6/tests/parser_unittest.cc b/src/bin/dhcp6/tests/parser_unittest.cc index 3d3b39b117..e2f3b13545 100644 --- a/src/bin/dhcp6/tests/parser_unittest.cc +++ b/src/bin/dhcp6/tests/parser_unittest.cc @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -37,7 +38,11 @@ namespace test { void compareJSON(ConstElementPtr a, ConstElementPtr b) { ASSERT_TRUE(a); ASSERT_TRUE(b); - EXPECT_EQ(a->str(), b->str()); + EXPECT_EQ(a->str(), b->str()) +#ifdef HAVE_CREATE_UNIFIED_DIFF + << "\nDiff:\n" << generateDiff(prettyPrint(a), prettyPrint(b)) << "\n" +#endif + ; } /// @brief Tests if the input string can be parsed with specific parser diff --git a/src/bin/netconf/tests/parser_unittests.cc b/src/bin/netconf/tests/parser_unittests.cc index b496470b00..b0acbb491d 100644 --- a/src/bin/netconf/tests/parser_unittests.cc +++ b/src/bin/netconf/tests/parser_unittests.cc @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -38,7 +39,11 @@ namespace test { void compareJSON(ConstElementPtr a, ConstElementPtr b) { ASSERT_TRUE(a); ASSERT_TRUE(b); - EXPECT_EQ(a->str(), b->str()); + EXPECT_EQ(a->str(), b->str()) +#ifdef HAVE_CREATE_UNIFIED_DIFF + << "\nDiff:\n" << generateDiff(prettyPrint(a), prettyPrint(b)) << "\n" +#endif + ; } /// @brief Tests if the input string can be parsed with specific parser