From: Steve Brokenshire Date: Tue, 22 Mar 2016 08:28:58 +0000 (+0000) Subject: Added some unit tests for EscapeString function (CommonFunctions/EscapeString) X-Git-Tag: release-0.11~14 X-Git-Url: http://Server1/repobrowser/?p=xestiaab%2F.git;a=commitdiff_plain;h=f8a1d6049c84aae54744e8535b0e53b0877d1fe7 Added some unit tests for EscapeString function (CommonFunctions/EscapeString) --- diff --git a/source/tests/xestiaab_common.h b/source/tests/xestiaab_common.h index 654cdc8..203278f 100644 --- a/source/tests/xestiaab_common.h +++ b/source/tests/xestiaab_common.h @@ -247,6 +247,29 @@ TEST(CommonFunctions, CheckBlacklist){ TEST(CommonFunctions, EscapeString){ + // Test the escape string function. + + EscapeStringData = "\"Example\""; + + ASSERT_EQ("\\\"Example\\\"", EscapeStringData(&EscapeStringData, false)); + + EscapeStringData = "Here we go, an \"example\" of escaping string."; + + ASSERT_EQ("Here we go\\, an \\\"example\\\" of escaping string.", EscapeStringData(&EscapeStringData, false)); + + EscapeStringData = "Lets put some \nnew \nlines \nin \nhere."; + + ASSERT_EQ("Lets put some \\nnew \\nlines \\nin \\nhere.", EscapeStringData(&EscapeStringData, false)); + + EscapeStringData = "Lets put some \r\nnew \r\nlines \r\nin \r\nhere."; + + ASSERT_EQ("Lets put some \\nnew \\nlines \\nin \\nhere.", EscapeStringData(&EscapeStringData, false)); + + EscapeStringData = "A:\path\example\lets\have\some\fun"; + + ASSERT_EQ("A:\\path\\example\\lets\\have\\some\\fun", EscapeStringData(&EscapeStringData, false)); + + } TEST(CommonFunctions, GetEscapeString){