summaryrefslogtreecommitdiffstats
path: root/test/WhiteBoxTests.cpp
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-10-14 10:51:59 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-10-14 11:58:07 +0200
commit95c700ff47692966d433f22861290a7f1332a38c (patch)
treebe134aa87b9981d22fad77a82d21d4a6cd16d30b /test/WhiteBoxTests.cpp
parentIntroduce --enable-bundle to decouple bundling from --enable-debug (diff)
downloadonline-95c700ff47692966d433f22861290a7f1332a38c.tar.gz
online-95c700ff47692966d433f22861290a7f1332a38c.zip
Test JsonUtil::escapeJSONValue()
Follow-up to commit d1bc6911b547268dfd1171087cba8223c9c34339 (Escape strings in JSON, 2021-10-13). Signed-off-by: Miklos Vajna <vmiklos@collabora.com> Change-Id: If8d21d6ebcf080f8893dedbebcd42aaad3b921a1
Diffstat (limited to 'test/WhiteBoxTests.cpp')
-rw-r--r--test/WhiteBoxTests.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/WhiteBoxTests.cpp b/test/WhiteBoxTests.cpp
index 2ba3c52889..b6a039f1b0 100644
--- a/test/WhiteBoxTests.cpp
+++ b/test/WhiteBoxTests.cpp
@@ -72,6 +72,7 @@ class WhiteBoxTests : public CPPUNIT_NS::TestFixture
CPPUNIT_TEST(testParseUrl);
CPPUNIT_TEST(testSafeAtoi);
CPPUNIT_TEST(testBytesToHex);
+ CPPUNIT_TEST(testJsonUtilEscapeJSONValue);
CPPUNIT_TEST_SUITE_END();
@@ -108,6 +109,7 @@ class WhiteBoxTests : public CPPUNIT_NS::TestFixture
void testParseUrl();
void testSafeAtoi();
void testBytesToHex();
+ void testJsonUtilEscapeJSONValue();
};
void WhiteBoxTests::testLOOLProtocolFunctions()
@@ -2230,6 +2232,13 @@ void WhiteBoxTests::testBytesToHex()
}
}
+void WhiteBoxTests::testJsonUtilEscapeJSONValue()
+{
+ const std::string in = "domain\\username";
+ const std::string expected = "domain\\\\username";
+ LOK_ASSERT_EQUAL(JsonUtil::escapeJSONValue(in), expected);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(WhiteBoxTests);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */