]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3003] Fixed more indentation
authorFrancis Dupont <fdupont@isc.org>
Tue, 8 Aug 2023 08:50:29 +0000 (10:50 +0200)
committerFrancis Dupont <fdupont@isc.org>
Tue, 8 Aug 2023 08:50:29 +0000 (10:50 +0200)
src/bin/agent/tests/parser_unittests.cc
src/bin/d2/tests/parser_unittest.cc
src/bin/dhcp4/tests/parser_unittest.cc
src/bin/dhcp6/tests/parser_unittest.cc
src/bin/netconf/tests/parser_unittests.cc

index 56a5338cf325f9cd230013a34f3dd0a9b82c6716..dfbc14d7dfcb550357b1011042e4bd9d68a5f63d 100644 (file)
@@ -89,7 +89,7 @@ TEST(ParserTest, mapInMap) {
 
 TEST(ParserTest, listInList) {
     string txt = "[ [ \"Britain\", \"Wales\", \"Scotland\" ], "
-                 "  [ \"Pomorze\", \"Wielkopolska\", \"Tatry\"] ]";
+                 "[ \"Pomorze\", \"Wielkopolska\", \"Tatry\"] ]";
     testParser(txt, ParserContext::PARSER_JSON);
 }
 
@@ -105,31 +105,31 @@ TEST(ParserTest, nestedLists) {
 
 TEST(ParserTest, listsInMaps) {
     string txt = "{ \"constellations\": { \"orion\": [ \"rigel\", \"betelgeuse\" ], "
-                   "\"cygnus\": [ \"deneb\", \"albireo\"] } }";
+                 "\"cygnus\": [ \"deneb\", \"albireo\"] } }";
     testParser(txt, ParserContext::PARSER_JSON);
 }
 
 TEST(ParserTest, mapsInLists) {
-    string txt = "[ { \"body\": \"earth\", \"gravity\": 1.0 },"
-                 "  { \"body\": \"mars\", \"gravity\": 0.376 } ]";
+    string txt = "[ { \"body\": \"earth\", \"gravity\": 1.0 }, "
+                 "{ \"body\": \"mars\", \"gravity\": 0.376 } ]";
     testParser(txt, ParserContext::PARSER_JSON);
 }
 
 TEST(ParserTest, types) {
-    string txt = "{ \"string\": \"foo\","
-                   "\"integer\": 42,"
-                   "\"boolean\": true,"
-                   "\"map\": { \"foo\": \"bar\" },"
-                   "\"list\": [ 1, 2, 3 ],"
-                   "\"null\": null }";
+    string txt = "{ \"string\": \"foo\", "
+                 "\"integer\": 42, "
+                 "\"boolean\": true, "
+                 "\"map\": { \"foo\": \"bar\" }, "
+                 "\"list\": [ 1, 2, 3 ], "
+                 "\"null\": null }";
     testParser(txt, ParserContext::PARSER_JSON);
 }
 
 TEST(ParserTest, keywordJSON) {
-    string txt = "{ \"name\": \"user\","
-                   "\"type\": \"password\","
-                   "\"user\": \"name\","
-                   "\"password\": \"type\" }";
+    string txt = "{ \"name\": \"user\", "
+                 "\"type\": \"password\", "
+                 "\"user\": \"name\", "
+                 "\"password\": \"type\" }";
     testParser(txt, ParserContext::PARSER_JSON);
 }
 
@@ -199,6 +199,7 @@ TEST(ParserTest, keywordSubAgent) {
         "    }"
         "   ]"
         "}";
+
     // This is only a subset of full config, so we'll parse with PARSER_SUB_AGENT.
     testParser(txt, ParserContext::PARSER_SUB_AGENT);
     testParser(txt, ParserContext::PARSER_JSON);
@@ -207,8 +208,8 @@ TEST(ParserTest, keywordSubAgent) {
 // Tests if bash (#) comments are supported. That's the only comment type that
 // was supported by the old parser.
 TEST(ParserTest, bashComments) {
-    string txt = "{ \"Control-agent\": {"
-                 "  \"http-host\": \"localhost\","
+    string txt = "{ \"Control-agent\": {\n"
+                 "  \"http-host\": \"localhost\",\n"
                  "  \"http-port\": 9000,\n"
                  "  \"control-sockets\": {\n"
                  "    \"d2\": {\n"
@@ -223,8 +224,8 @@ TEST(ParserTest, bashComments) {
 
 // Tests if C++ (//) comments can start anywhere, not just in the first line.
 TEST(ParserTest, cppComments) {
-    string txt = "{ \"Control-agent\": {"
-                 "  \"http-host\": \"localhost\","
+    string txt = "{ \"Control-agent\": {\n"
+                 "  \"http-host\": \"localhost\",\n"
                  "  \"http-port\": 9001, // the level is over 9000!\n"
                  "  \"control-sockets\": {\n"
                  "    // Let's try talking to D2. Sadly, it never talks"
@@ -238,8 +239,8 @@ TEST(ParserTest, cppComments) {
 
 // Tests if bash (#) comments can start anywhere, not just in the first line.
 TEST(ParserTest, bashCommentsInline) {
-    string txt= "{ \"Control-agent\": {"
-                "  \"http-host\": \"localhost\","
+    string txt= "{ \"Control-agent\": {\n"
+                "  \"http-host\": \"localhost\",\n"
                 "  \"http-port\": 9000,\n"
                 "  \"control-sockets\": {\n"
                 "    \"d2\": {"
@@ -252,8 +253,8 @@ TEST(ParserTest, bashCommentsInline) {
 
 // Tests if multi-line C style comments are handled correctly.
 TEST(ParserTest, multilineComments) {
-    string txt = "{ \"Control-agent\": {"
-                 "  \"http-host\": \"localhost\","
+    string txt = "{ \"Control-agent\": {\n"
+                 "  \"http-host\": \"localhost\",\n"
                  "  \"http-port\": 9000,\n"
                  "  \"control-sockets\": {\n"
                  "    \"dhcp4\": {\n"
@@ -270,9 +271,9 @@ TEST(ParserTest, multilineComments) {
 
 // Tests if embedded comments are handled correctly.
 TEST(ParserTest, embbededComments) {
-    string txt = "{ \"Control-agent\": {"
-                 "  \"comment\": \"a comment\","
-                 "  \"http-host\": \"localhost\","
+    string txt = "{ \"Control-agent\": {\n"
+                 "  \"comment\": \"a comment\",\n"
+                 "  \"http-host\": \"localhost\",\n"
                  "  \"http-port\": 9000,\n"
                  "  \"control-sockets\": {\n"
                  "    \"dhcp4\": {\n"
index 214738f6f0eef7475e5f6fc57f16c726a341c145..9f741654e7fc8b78584d7ff9138df0efad1ac3e5 100644 (file)
@@ -91,7 +91,7 @@ TEST(ParserTest, mapInMap) {
 
 TEST(ParserTest, listInList) {
     string txt = "[ [ \"Britain\", \"Wales\", \"Scotland\" ], "
-                 "  [ \"Pomorze\", \"Wielkopolska\", \"Tatry\"] ]";
+                 "[ \"Pomorze\", \"Wielkopolska\", \"Tatry\"] ]";
     testParser(txt, D2ParserContext::PARSER_JSON);
 }
 
@@ -107,31 +107,31 @@ TEST(ParserTest, nestedLists) {
 
 TEST(ParserTest, listsInMaps) {
     string txt = "{ \"constellations\": { \"orion\": [ \"rigel\", \"betelgeuse\" ], "
-                   "\"cygnus\": [ \"deneb\", \"albireo\"] } }";
+                 "\"cygnus\": [ \"deneb\", \"albireo\"] } }";
     testParser(txt, D2ParserContext::PARSER_JSON);
 }
 
 TEST(ParserTest, mapsInLists) {
-    string txt = "[ { \"body\": \"earth\", \"gravity\": 1.0 },"
-                 "  { \"body\": \"mars\", \"gravity\": 0.376 } ]";
+    string txt = "[ { \"body\": \"earth\", \"gravity\": 1.0 }, "
+                 "{ \"body\": \"mars\", \"gravity\": 0.376 } ]";
     testParser(txt, D2ParserContext::PARSER_JSON);
 }
 
 TEST(ParserTest, types) {
-    string txt = "{ \"string\": \"foo\","
-                   "\"integer\": 42,"
-                   "\"boolean\": true,"
-                   "\"map\": { \"foo\": \"bar\" },"
-                   "\"list\": [ 1, 2, 3 ],"
-                   "\"null\": null }";
+    string txt = "{ \"string\": \"foo\", "
+                 "\"integer\": 42, "
+                 "\"boolean\": true, "
+                 "\"map\": { \"foo\": \"bar\" }, "
+                 "\"list\": [ 1, 2, 3 ], "
+                 "\"null\": null }";
     testParser(txt, D2ParserContext::PARSER_JSON);
 }
 
 TEST(ParserTest, keywordJSON) {
-    string txt = "{ \"name\": \"user\","
-                   "\"type\": \"password\","
-                   "\"user\": \"name\","
-                   "\"password\": \"type\" }";
+    string txt = "{ \"name\": \"user\", "
+                 "\"type\": \"password\", "
+                 "\"user\": \"name\", "
+                 "\"password\": \"type\" }";
     testParser(txt, D2ParserContext::PARSER_JSON);
 }
 
@@ -156,18 +156,18 @@ TEST(ParserTest, keywordDhcpDdns) {
 TEST(ParserTest, bashComments) {
     string txt =
         "{ \"DhcpDdns\" : \n"
-           "{ \n"
-            " \"ip-address\": \"192.168.77.1\", \n"
-            "# this is a comment\n"
-            " \"port\": 777, \n "
-            " \"ncr-protocol\": \"UDP\", \n"
-            "# lots of comments here\n"
-            "# and here\n"
-            " \"tsig-keys\": [], \n"
-            " \"forward-ddns\" : {}, \n"
-            " \"reverse-ddns\" : {} \n"
-            "} \n"
-         "} \n";
+        "{ \n"
+        " \"ip-address\": \"192.168.77.1\", \n"
+        "# this is a comment\n"
+        " \"port\": 777, \n "
+        " \"ncr-protocol\": \"UDP\", \n"
+        "# lots of comments here\n"
+        "# and here\n"
+        " \"tsig-keys\": [], \n"
+        " \"forward-ddns\" : {}, \n"
+        " \"reverse-ddns\" : {} \n"
+        } \n"
+        "} \n";
     testParser(txt, D2ParserContext::PARSER_DHCPDDNS);
 }
 
@@ -175,15 +175,15 @@ TEST(ParserTest, bashComments) {
 TEST(ParserTest, cppComments) {
     string txt =
         "{ \"DhcpDdns\" : \n"
-           "{ \n"
-            " \"ip-address\": \"192.168.77.1\", \n"
-            " \"port\": 777, // this is a comment \n"
-            " \"ncr-protocol\": \"UDP\", // everything after // is ignored\n"
-            " \"tsig-keys\": [], // this will be ignored, too\n"
-            " \"forward-ddns\" : {}, \n"
-            " \"reverse-ddns\" : {} \n"
-            "} \n"
-         "} \n";
+        "{ \n"
+        " \"ip-address\": \"192.168.77.1\", \n"
+        " \"port\": 777, // this is a comment \n"
+        " \"ncr-protocol\": \"UDP\", // everything after // is ignored\n"
+        " \"tsig-keys\": [], // this will be ignored, too\n"
+        " \"forward-ddns\" : {}, \n"
+        " \"reverse-ddns\" : {} \n"
+        } \n"
+        "} \n";
     testParser(txt, D2ParserContext::PARSER_DHCPDDNS, false);
 }
 
@@ -191,15 +191,15 @@ TEST(ParserTest, cppComments) {
 TEST(ParserTest, bashCommentsInline) {
     string txt =
         "{ \"DhcpDdns\" : \n"
-           "{ \n"
-            " \"ip-address\": \"192.168.77.1\", \n"
-            " \"port\": 777, # this is a comment \n"
-            " \"ncr-protocol\": \"UDP\", # everything after # is ignored\n"
-            " \"tsig-keys\": [], # this will be ignored, too\n"
-            " \"forward-ddns\" : {}, \n"
-            " \"reverse-ddns\" : {} \n"
-            "} \n"
-         "} \n";
+        "{ \n"
+        " \"ip-address\": \"192.168.77.1\", \n"
+        " \"port\": 777, # this is a comment \n"
+        " \"ncr-protocol\": \"UDP\", # everything after # is ignored\n"
+        " \"tsig-keys\": [], # this will be ignored, too\n"
+        " \"forward-ddns\" : {}, \n"
+        " \"reverse-ddns\" : {} \n"
+        } \n"
+        "} \n";
     testParser(txt, D2ParserContext::PARSER_DHCPDDNS, false);
 }
 
@@ -207,16 +207,16 @@ TEST(ParserTest, bashCommentsInline) {
 TEST(ParserTest, multilineComments) {
     string txt =
         "{ \"DhcpDdns\" : \n"
-           "{ \n"
-            " \"ip-address\": \"192.168.77.1\", \n"
-            " \"port\": 777, /* this is a C style comment\n"
-            "that\n can \n span \n multiple \n lines */ \n"
-            " \"ncr-protocol\": \"UDP\", \n"
-            " \"tsig-keys\": [], \n"
-            " \"forward-ddns\" : {}, \n"
-            " \"reverse-ddns\" : {} \n"
-            "} \n"
-         "} \n";
+        "{ \n"
+        " \"ip-address\": \"192.168.77.1\", \n"
+        " \"port\": 777, /* this is a C style comment\n"
+        "that\n can \n span \n multiple \n lines */ \n"
+        " \"ncr-protocol\": \"UDP\", \n"
+        " \"tsig-keys\": [], \n"
+        " \"forward-ddns\" : {}, \n"
+        " \"reverse-ddns\" : {} \n"
+        } \n"
+        "} \n";
     testParser(txt, D2ParserContext::PARSER_DHCPDDNS, false);
 }
 
@@ -224,19 +224,19 @@ TEST(ParserTest, multilineComments) {
 TEST(ParserTest, embbededComments) {
     string txt =
         "{ \"DhcpDdns\" : \n"
-           "{ \n"
-            " \"comment\": \"a comment\",\n"
-            " \"ip-address\": \"192.168.77.1\", \n"
-            " \"port\": 777, \n "
-            " \"ncr-protocol\": \"UDP\", \n"
-            " \"tsig-keys\" : [ { \n"
-            "     \"name\" : \"d2.md5.key\", \n"
-            "     \"user-context\" : { \"comment\" : \"indirect\" } } ], \n"
-            " \"forward-ddns\" : {}, \n"
-            " \"reverse-ddns\" : {}, \n"
-            " \"user-context\": { \"compatible\": true }"
-            "} \n"
-         "} \n";
+        "{ \n"
+        " \"comment\": \"a comment\",\n"
+        " \"ip-address\": \"192.168.77.1\", \n"
+        " \"port\": 777, \n "
+        " \"ncr-protocol\": \"UDP\", \n"
+        " \"tsig-keys\" : [ { \n"
+        "     \"name\" : \"d2.md5.key\", \n"
+        "     \"user-context\" : { \"comment\" : \"indirect\" } } ], \n"
+        " \"forward-ddns\" : {}, \n"
+        " \"reverse-ddns\" : {}, \n"
+        " \"user-context\": { \"compatible\": true }"
+        } \n"
+        "} \n";
     testParser(txt, D2ParserContext::PARSER_DHCPDDNS, false);
 }
 
@@ -244,12 +244,12 @@ TEST(ParserTest, embbededComments) {
 TEST(ParserTest, outputDashOptions) {
     string txt =
         "{ \"DhcpDdns\" : \n"
-            "{ \n"
-             " \"loggers\": [ {\n"
-             "     \"name\": \"kea-dhcp-ddns\",\n"
-             "     \"output-options\": [ { \"output\": \"stdout\" } ],\n"
-             "     \"severity\": \"INFO\" } ]\n"
-             "} \n"
+        "{ \n"
+        " \"loggers\": [ {\n"
+        "     \"name\": \"kea-dhcp-ddns\",\n"
+        "     \"output-options\": [ { \"output\": \"stdout\" } ],\n"
+        "     \"severity\": \"INFO\" } ]\n"
+        } \n"
         "} \n";
     testParser(txt, D2ParserContext::PARSER_DHCPDDNS, false);
 }
index a226106faf7633045b81380b90819174099c1424..fa304086935ce54047849932d5480d77d58170f3 100644 (file)
@@ -89,7 +89,7 @@ TEST(ParserTest, mapInMap) {
 
 TEST(ParserTest, listInList) {
     string txt = "[ [ \"Britain\", \"Wales\", \"Scotland\" ], "
-                 "  [ \"Pomorze\", \"Wielkopolska\", \"Tatry\"] ]";
+                 "[ \"Pomorze\", \"Wielkopolska\", \"Tatry\"] ]";
     testParser(txt, Parser4Context::PARSER_JSON);
 }
 
@@ -105,31 +105,31 @@ TEST(ParserTest, nestedLists) {
 
 TEST(ParserTest, listsInMaps) {
     string txt = "{ \"constellations\": { \"orion\": [ \"rigel\", \"betelgeuse\" ], "
-                   "\"cygnus\": [ \"deneb\", \"albireo\"] } }";
+                 "\"cygnus\": [ \"deneb\", \"albireo\"] } }";
     testParser(txt, Parser4Context::PARSER_JSON);
 }
 
 TEST(ParserTest, mapsInLists) {
-    string txt = "[ { \"body\": \"earth\", \"gravity\": 1.0 },"
-                 "  { \"body\": \"mars\", \"gravity\": 0.376 } ]";
+    string txt = "[ { \"body\": \"earth\", \"gravity\": 1.0 }, "
+                 "{ \"body\": \"mars\", \"gravity\": 0.376 } ]";
     testParser(txt, Parser4Context::PARSER_JSON);
 }
 
 TEST(ParserTest, types) {
-    string txt = "{ \"string\": \"foo\","
-                   "\"integer\": 42,"
-                   "\"boolean\": true,"
-                   "\"map\": { \"foo\": \"bar\" },"
-                   "\"list\": [ 1, 2, 3 ],"
-                   "\"null\": null }";
+    string txt = "{ \"string\": \"foo\", "
+                 "\"integer\": 42, "
+                 "\"boolean\": true, "
+                 "\"map\": { \"foo\": \"bar\" }, "
+                 "\"list\": [ 1, 2, 3 ], "
+                 "\"null\": null }";
     testParser(txt, Parser4Context::PARSER_JSON);
 }
 
 TEST(ParserTest, keywordJSON) {
-    string txt = "{ \"name\": \"user\","
-                   "\"type\": \"password\","
-                   "\"user\": \"name\","
-                   "\"password\": \"type\" }";
+    string txt = "{ \"name\": \"user\", "
+                 "\"type\": \"password\", "
+                 "\"user\": \"name\", "
+                 "\"password\": \"type\" }";
     testParser(txt, Parser4Context::PARSER_JSON);
 }
 
index bdcf4163440c6c89c841093195ad75e139f69eab..ddeea949cf5580bd517593f24a1b96c2f31d60f1 100644 (file)
@@ -89,7 +89,7 @@ TEST(ParserTest, mapInMap) {
 
 TEST(ParserTest, listInList) {
     string txt = "[ [ \"Britain\", \"Wales\", \"Scotland\" ], "
-                 "  [ \"Pomorze\", \"Wielkopolska\", \"Tatry\"] ]";
+                 "[ \"Pomorze\", \"Wielkopolska\", \"Tatry\"] ]";
     testParser(txt, Parser6Context::PARSER_JSON);
 }
 
@@ -105,31 +105,31 @@ TEST(ParserTest, nestedLists) {
 
 TEST(ParserTest, listsInMaps) {
     string txt = "{ \"constellations\": { \"orion\": [ \"rigel\", \"betelgeuse\" ], "
-                   "\"cygnus\": [ \"deneb\", \"albireo\"] } }";
+                 "\"cygnus\": [ \"deneb\", \"albireo\"] } }";
     testParser(txt, Parser6Context::PARSER_JSON);
 }
 
 TEST(ParserTest, mapsInLists) {
-    string txt = "[ { \"body\": \"earth\", \"gravity\": 1.0 },"
-                 "  { \"body\": \"mars\", \"gravity\": 0.376 } ]";
+    string txt = "[ { \"body\": \"earth\", \"gravity\": 1.0 }, "
+                 "{ \"body\": \"mars\", \"gravity\": 0.376 } ]";
     testParser(txt, Parser6Context::PARSER_JSON);
 }
 
 TEST(ParserTest, types) {
-    string txt = "{ \"string\": \"foo\","
-                   "\"integer\": 42,"
-                   "\"boolean\": true,"
-                   "\"map\": { \"foo\": \"bar\" },"
-                   "\"list\": [ 1, 2, 3 ],"
-                   "\"null\": null }";
+    string txt = "{ \"string\": \"foo\", "
+                 "\"integer\": 42, "
+                 "\"boolean\": true, "
+                 "\"map\": { \"foo\": \"bar\" }, "
+                 "\"list\": [ 1, 2, 3 ], "
+                 "\"null\": null }";
     testParser(txt, Parser6Context::PARSER_JSON);
 }
 
 TEST(ParserTest, keywordJSON) {
-    string txt = "{ \"name\": \"user\","
-                   "\"type\": \"password\","
-                   "\"user\": \"name\","
-                   "\"password\": \"type\" }";
+    string txt = "{ \"name\": \"user\", "
+                 "\"type\": \"password\", "
+                 "\"user\": \"name\", "
+                 "\"password\": \"type\" }";
     testParser(txt, Parser6Context::PARSER_JSON);
 }
 
index 5c8cd87c6028d2590e825bd749b459922c2cd67c..504c4f208fbd4ec1c078cb22baf4c1f8738cc16f 100644 (file)
@@ -91,7 +91,7 @@ TEST(ParserTest, mapInMap) {
 
 TEST(ParserTest, listInList) {
     string txt = "[ [ \"Britain\", \"Wales\", \"Scotland\" ], "
-                 "  [ \"Pomorze\", \"Wielkopolska\", \"Tatry\"] ]";
+                 "[ \"Pomorze\", \"Wielkopolska\", \"Tatry\"] ]";
     testParser(txt, ParserContext::PARSER_JSON);
 }
 
@@ -107,31 +107,31 @@ TEST(ParserTest, nestedLists) {
 
 TEST(ParserTest, listsInMaps) {
     string txt = "{ \"constellations\": { \"orion\": [ \"rigel\", \"betelgeuse\" ], "
-                   "\"cygnus\": [ \"deneb\", \"albireo\"] } }";
+                 "\"cygnus\": [ \"deneb\", \"albireo\"] } }";
     testParser(txt, ParserContext::PARSER_JSON);
 }
 
 TEST(ParserTest, mapsInLists) {
-    string txt = "[ { \"body\": \"earth\", \"gravity\": 1.0 },"
-                 "  { \"body\": \"mars\", \"gravity\": 0.376 } ]";
+    string txt = "[ { \"body\": \"earth\", \"gravity\": 1.0 }, "
+                 "{ \"body\": \"mars\", \"gravity\": 0.376 } ]";
     testParser(txt, ParserContext::PARSER_JSON);
 }
 
 TEST(ParserTest, types) {
-    string txt = "{ \"string\": \"foo\","
-                   "\"integer\": 42,"
-                   "\"boolean\": true,"
-                   "\"map\": { \"foo\": \"bar\" },"
-                   "\"list\": [ 1, 2, 3 ],"
-                   "\"null\": null }";
+    string txt = "{ \"string\": \"foo\", "
+                 "\"integer\": 42, "
+                 "\"boolean\": true, "
+                 "\"map\": { \"foo\": \"bar\" }, "
+                 "\"list\": [ 1, 2, 3 ], "
+                 "\"null\": null }";
     testParser(txt, ParserContext::PARSER_JSON);
 }
 
 TEST(ParserTest, keywordJSON) {
-    string txt = "{ \"name\": \"user\","
-                   "\"type\": \"password\","
-                   "\"user\": \"name\","
-                   "\"password\": \"type\" }";
+    string txt = "{ \"name\": \"user\", "
+                 "\"type\": \"password\", "
+                 "\"user\": \"name\", "
+                 "\"password\": \"type\" }";
     testParser(txt, ParserContext::PARSER_JSON);
 }