diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-03-21 22:10:34 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-03-21 22:10:34 +0000 |
commit | cc9369cdf97415e514c8f751e14788d0c90f073b (patch) | |
tree | b140ba71cda1dbcd59dba23e49d2dda41390f7d9 /src/libutil | |
parent | c6e1d269b6da83924b5eb53eda52a63c4286bd99 (diff) | |
download | rspamd-cc9369cdf97415e514c8f751e14788d0c90f073b.tar.gz rspamd-cc9369cdf97415e514c8f751e14788d0c90f073b.zip |
[Test] Add some more test cases
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/cxx/utf8_util.cxx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libutil/cxx/utf8_util.cxx b/src/libutil/cxx/utf8_util.cxx index c69191e8b..dadd5fc6e 100644 --- a/src/libutil/cxx/utf8_util.cxx +++ b/src/libutil/cxx/utf8_util.cxx @@ -229,12 +229,24 @@ TEST_CASE("utf8 normalise") { {"\xE2\x80\x8B""те""\xE2\x80\x8B""ст", "тест", RSPAMD_UNICODE_NORM_ZERO_SPACES}, /* Special case of diacritic */ {"13_\u0020\u0308\u0301\u038e\u03ab", "13_ ̈́ΎΫ", RSPAMD_UNICODE_NORM_UNNORMAL}, + // String containing a non-joiner character + { "س\u200Cت", "ست", RSPAMD_UNICODE_NORM_ZERO_SPACES }, + // String containing a soft hyphen + { "in\u00ADter\u00ADest\u00ADing", "interesting", RSPAMD_UNICODE_NORM_ZERO_SPACES }, + // String with ligature + { "fish", "fish", RSPAMD_UNICODE_NORM_UNNORMAL }, + // String with accented characters and zero-width spaces + { "café\u200Blatté\u200C", "cafélatté", RSPAMD_UNICODE_NORM_ZERO_SPACES }, /* Same with zw spaces */ {"13\u200C_\u0020\u0308\u0301\u038e\u03ab", "13_ ̈́ΎΫ", RSPAMD_UNICODE_NORM_UNNORMAL|RSPAMD_UNICODE_NORM_ZERO_SPACES}, /* Buffer overflow case */ {"u\xC2\xC2\xC2\xC2\xC2\xC2""abcdef""abcdef", "u\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD", RSPAMD_UNICODE_NORM_UNNORMAL|RSPAMD_UNICODE_NORM_ERROR}, + // String with a mix of special characters, ligatures, and zero-width spaces + { "fish\u200Bcafé\u200C\u200Dlatté\u200D\u00AD", "fishcafé\u200Dlatté\u200D", RSPAMD_UNICODE_NORM_UNNORMAL | RSPAMD_UNICODE_NORM_ZERO_SPACES }, + // Empty string + { "", "", RSPAMD_UNICODE_NORM_NORMAL}, }; for (const auto &c : cases) { |