Browse Source

[4510] Added unit-test that replicates the issue of mishandling backslashes.

Tomek Mrugalski 9 years ago
parent
commit
5a188f631d
1 changed files with 9 additions and 0 deletions
  1. 9 0
      src/lib/cc/tests/data_unittests.cc

+ 9 - 0
src/lib/cc/tests/data_unittests.cc

@@ -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 ]");