From: Tomek Mrugalski Date: Tue, 17 May 2016 17:28:48 +0000 (+0200) Subject: [4510] Added unit-test that replicates the issue of mishandling backslashes. X-Git-Tag: trac4106_update_base~7^2~1^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a188f631da92b648ffb667543348df9e82c3899;p=thirdparty%2Fkea.git [4510] Added unit-test that replicates the issue of mishandling backslashes. --- diff --git a/src/lib/cc/tests/data_unittests.cc b/src/lib/cc/tests/data_unittests.cc index 65e63b3644..a8001a29be 100644 --- a/src/lib/cc/tests/data_unittests.cc +++ b/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 ]");