cut messages at 512 bytes, taking into account the UTF-8 codepoints

ref #3067
This commit is contained in:
louiz’
2016-06-15 15:50:45 +02:00
parent 6235fb2d03
commit 4b1c580bb9
3 changed files with 22 additions and 5 deletions
+7 -1
View File
@@ -93,4 +93,10 @@ TEST_CASE("string cut")
{
CHECK(cut("coucou", 2).size() == 3);
CHECK(cut("bonjour les copains", 6).size() == 4);
}
CHECK(cut("««««", 2).size() == 4);
CHECK(cut("a««««", 2).size() == 5);
const auto res = cut("rhello, ♥", 10);
CHECK(res.size() == 2);
CHECK(res[0] == "rhello, ");
CHECK(res[1] == "♥");
}