]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2688] Fixed failing parser test
authorMarcin Siodelski <marcin@isc.org>
Mon, 16 Jan 2023 21:15:19 +0000 (22:15 +0100)
committerAndrei Pavel <andrei@isc.org>
Thu, 13 Jul 2023 10:27:55 +0000 (13:27 +0300)
src/bin/agent/tests/parser_unittests.cc
src/bin/d2/tests/parser_unittest.cc
src/bin/dhcp4/tests/parser_unittest.cc
src/bin/dhcp6/dhcp6_parser.yy
src/bin/dhcp6/tests/parser_unittest.cc
src/bin/netconf/tests/parser_unittests.cc

index 2b35ac62c085812ac39a15ef5a52ec2fd9754f4d..d129291beb061c51e847fd26bcefb99baf086516 100644 (file)
@@ -11,6 +11,7 @@
 #include <cc/dhcp_config_error.h>
 #include <testutils/io_utils.h>
 #include <testutils/log_utils.h>
+#include <testutils/test_to_element.h>
 #include <testutils/user_context_utils.h>
 
 #include <gtest/gtest.h>
@@ -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
index 910051172a592a2014e795c26ab072c633dcea35..4635a3bf974d80d019e82d5a6e8e41ae21145ed2 100644 (file)
@@ -10,6 +10,7 @@
 #include <d2/tests/parser_unittest.h>
 #include <testutils/io_utils.h>
 #include <testutils/log_utils.h>
+#include <testutils/test_to_element.h>
 #include <testutils/user_context_utils.h>
 
 #include <gtest/gtest.h>
@@ -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
index 9a7e0db9952efc9dece948345531eaa5bf61c85d..e6b8c4ce2aedda01b56ea7aced6633e587509c80 100644 (file)
@@ -11,6 +11,7 @@
 #include <testutils/gtest_utils.h>
 #include <testutils/io_utils.h>
 #include <testutils/log_utils.h>
+#include <testutils/test_to_element.h>
 #include <testutils/user_context_utils.h>
 
 #include <gtest/gtest.h>
@@ -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
index 6a9c50e80edf7fa8cef6712618916db22856d693..e0609e1defe2e253254c6201e68bea48f79a7546 100644 (file)
@@ -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 {
index 3d3b39b1174449f5f3d723b1080c404dc0c88939..e2f3b13545feb597cc8912d794921bc0ceaae77e 100644 (file)
@@ -10,6 +10,7 @@
 #include <dhcpsrv/parsers/simple_parser6.h>
 #include <testutils/io_utils.h>
 #include <testutils/log_utils.h>
+#include <testutils/test_to_element.h>
 #include <testutils/user_context_utils.h>
 #include <testutils/gtest_utils.h>
 
@@ -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
index b496470b007ee1579d6be51635a749bb17b1836e..b0acbb491df2e613ca562e396f4cb1ee67731c81 100644 (file)
@@ -12,6 +12,7 @@
 #include <testutils/gtest_utils.h>
 #include <testutils/io_utils.h>
 #include <testutils/log_utils.h>
+#include <testutils/test_to_element.h>
 #include <testutils/user_context_utils.h>
 
 #include <gtest/gtest.h>
@@ -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