summaryrefslogtreecommitdiffstats
path: root/src/bin/netconf
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2021-12-16 22:38:03 +0100
committerAndrei Pavel <andrei@isc.org>2021-12-17 16:21:22 +0100
commitab4609bddaa2871951d160bba4bd76b5fbbe47f4 (patch)
tree5a9cb07b3d5903866176c899bdf33dc8acf73a41 /src/bin/netconf
parent[#2084] Report the comma (diff)
downloadkea-ab4609bddaa2871951d160bba4bd76b5fbbe47f4.tar.xz
kea-ab4609bddaa2871951d160bba4bd76b5fbbe47f4.zip
[#2084] Added log checking
Diffstat (limited to 'src/bin/netconf')
-rw-r--r--src/bin/netconf/tests/parser_unittests.cc22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/bin/netconf/tests/parser_unittests.cc b/src/bin/netconf/tests/parser_unittests.cc
index f8a372f4ea..da953a09b7 100644
--- a/src/bin/netconf/tests/parser_unittests.cc
+++ b/src/bin/netconf/tests/parser_unittests.cc
@@ -11,6 +11,7 @@
#include <netconf/parser_context.h>
#include <testutils/gtest_utils.h>
#include <testutils/io_utils.h>
+#include <testutils/log_utils.h>
#include <testutils/user_context_utils.h>
#include <gtest/gtest.h>
@@ -917,8 +918,23 @@ TEST(ParserTest, duplicateMapEntries) {
cout << "checked " << cnt << " duplicated map entries\n";
}
+/// @brief Test fixture for trailing commas.
+class TrailingCommasTest : public isc::dhcp::test::LogContentTest {
+public:
+ /// @brief Add a log entry.
+ ///
+ /// @param loc Location of the trailing comma.
+ void addLog(const string& loc) {
+ string log = "NETCONF_CONFIG_SYNTAX_WARNING Netconf ";
+ log += "configuration syntax warning: " + loc;
+ log += ": Extraneous comma. ";
+ log += "A piece of configuration may have been omitted.";
+ addString(log);
+ }
+};
+
// Test that trailing commas are allowed.
-TEST(ParserTest, trailingCommas) {
+TEST_F(TrailingCommasTest, tests) {
string txt(R"({
"Netconf": {
"boot-update": true,
@@ -951,6 +967,10 @@ TEST(ParserTest, trailingCommas) {
})");
testParser(txt, ParserContext::PARSER_NETCONF, false);
+ addLog("<string>:7.16");
+ /// @todo
+ EXPECT_TRUE(checkFile());
+
// Test with many consecutive commas.
boost::replace_all(txt, ",", ",,,,");
testParser(txt, ParserContext::PARSER_NETCONF, false);