diff options
| author | Dentomologist <dentomologist@gmail.com> | 2021-05-24 09:44:21 -0700 |
|---|---|---|
| committer | Dentomologist <dentomologist@gmail.com> | 2021-06-01 17:22:19 -0700 |
| commit | 99ed43280dec1eec088bbf4242105c0953924e39 (patch) | |
| tree | b2b9a6284b925adeea3f3221791e1ca0d5273867 /Source/UnitTests/Common/StringUtilTest.cpp | |
| parent | a12865570d7c0eacd77f1bed850772e5f8aea4d9 (diff) | |
Updater: Escape HTML characters in commit descriptions
Diffstat (limited to 'Source/UnitTests/Common/StringUtilTest.cpp')
| -rw-r--r-- | Source/UnitTests/Common/StringUtilTest.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
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<float>({0.0f, 1.0f, -1.0f, -0.5f, 0.5f, -1e-3f, 1e-3f, 1e3f, -1e3f}); DoRoundTripTest<double>({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("&&&"), "&&&"); +} |
