From 99ed43280dec1eec088bbf4242105c0953924e39 Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Mon, 24 May 2021 09:44:21 -0700 Subject: Updater: Escape HTML characters in commit descriptions --- Source/UnitTests/Common/StringUtilTest.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Source/UnitTests/Common/StringUtilTest.cpp') diff --git a/Source/UnitTests/Common/StringUtilTest.cpp b/Source/UnitTests/Common/StringUtilTest.cpp index b9b186c131..fe837be455 100644 --- a/Source/UnitTests/Common/StringUtilTest.cpp +++ b/Source/UnitTests/Common/StringUtilTest.cpp @@ -105,3 +105,13 @@ TEST(StringUtil, ToString_TryParse_Roundtrip) DoRoundTripTest({0.0f, 1.0f, -1.0f, -0.5f, 0.5f, -1e-3f, 1e-3f, 1e3f, -1e3f}); DoRoundTripTest({0.0, 1.0, -1.0, -0.5, 0.5, -1e-3, 1e-3, 1e3, -1e3}); } + +TEST(StringUtil, GetEscapedHtml) +{ + static constexpr auto no_escape_needed = + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" + "!@#$%^*()-_=+,./?;:[]{}| \\\t\n"; + EXPECT_EQ(GetEscapedHtml(no_escape_needed), no_escape_needed); + EXPECT_EQ(GetEscapedHtml("&<>'\""), "&<>'""); + EXPECT_EQ(GetEscapedHtml("&&&"), "&&&"); +} -- cgit v1.2.3