]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[4510] Added unit-test that replicates the issue of mishandling backslashes.
authorTomek Mrugalski <tomasz@isc.org>
Tue, 17 May 2016 17:28:48 +0000 (19:28 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Tue, 17 May 2016 17:28:48 +0000 (19:28 +0200)
src/lib/cc/tests/data_unittests.cc

index 65e63b3644baeeb9379af0801c37f3023a552cb8..a8001a29be791d3348fb5f56736fca67cb132d44 100644 (file)
@@ -561,6 +561,15 @@ TEST(Element, escape) {
     EXPECT_NO_THROW(Element::fromJSON("\"  \n  \r \t \f  \n \n    \t\""));
 }
 
+// This test verifies if a backslash can be defined properly.
+TEST(Element, backslash) {
+    string input = "SMSBoot\\\\x64"; // Two slashes put in the config file...
+    string exp = "SMSBoot\\x64"; // ... should result in one slash in the actual option.
+
+    StringElement elem(input);
+    EXPECT_EQ(exp, elem.stringValue());
+}
+
 TEST(Element, ListElement) {
     // this function checks the specific functions for ListElements
     ElementPtr el = Element::fromJSON("[ 1, \"bar\", 3 ]");