summaryrefslogtreecommitdiffstats
path: root/util/string/strip_ut.cpp
diff options
context:
space:
mode:
authorppavel96 <[email protected]>2023-06-22 11:25:00 +0300
committerppavel96 <[email protected]>2023-06-22 11:25:00 +0300
commit6e1cc98994e9cfbd532fbc9ab707bd56373245f5 (patch)
treeeda42f6fa64a7120f930ca1f940248a050fd572f /util/string/strip_ut.cpp
parentd845680738f3051ec12fac59188c70ee1a623a88 (diff)
[util] Turn all Collapse / CollapseInPlace overloads into template functions to support arbitrary string types
Diffstat (limited to 'util/string/strip_ut.cpp')
-rw-r--r--util/string/strip_ut.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/util/string/strip_ut.cpp b/util/string/strip_ut.cpp
index 0b1687ffa7c..283ab66fdfa 100644
--- a/util/string/strip_ut.cpp
+++ b/util/string/strip_ut.cpp
@@ -139,6 +139,23 @@ Y_UNIT_TEST_SUITE(TStripStringTest) {
#endif
}
+ Y_UNIT_TEST(TestCollapseUtf16) {
+ TUtf16String s;
+ Collapse(UTF8ToWide<true>(" 123 456 "), s);
+ UNIT_ASSERT(s == UTF8ToWide<true>(" 123 456 "));
+ Collapse(UTF8ToWide<true>(" 123 456 "), s, 10);
+ UNIT_ASSERT(s == UTF8ToWide<true>(" 123 456 "));
+
+ s = UTF8ToWide<true>(" a b c ");
+ TUtf16String s2 = s;
+ CollapseInPlace(s2);
+
+ UNIT_ASSERT(s == s2);
+#ifndef TSTRING_IS_STD_STRING
+ UNIT_ASSERT(s.c_str() == s2.c_str()); // Collapse() does not change the string at all
+#endif
+ }
+
Y_UNIT_TEST(TestCollapse) {
TString s;
Collapse(TString(" 123 456 "), s);