summaryrefslogtreecommitdiff
path: root/tests/utils.cpp
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2016-06-15 12:19:19 +0200
committerlouiz’ <louiz@louiz.org>2016-06-15 15:50:45 +0200
commit4b1c580bb9bc03d656e59d702c72c3e793a1bbe0 (patch)
treea0e6c78955d1a06f54d39f55f16d280cd8e80a21 /tests/utils.cpp
parent6235fb2d0326b18a9e013ae13dfb1fd0577ffd9f (diff)
downloadbiboumi-4b1c580bb9bc03d656e59d702c72c3e793a1bbe0.tar.gz
biboumi-4b1c580bb9bc03d656e59d702c72c3e793a1bbe0.tar.bz2
biboumi-4b1c580bb9bc03d656e59d702c72c3e793a1bbe0.tar.xz
biboumi-4b1c580bb9bc03d656e59d702c72c3e793a1bbe0.zip
cut messages at 512 bytes, taking into account the UTF-8 codepoints
ref #3067
Diffstat (limited to 'tests/utils.cpp')
-rw-r--r--tests/utils.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/utils.cpp b/tests/utils.cpp
index 54e743f..01d070e 100644
--- a/tests/utils.cpp
+++ b/tests/utils.cpp
@@ -93,4 +93,10 @@ TEST_CASE("string cut")
{
CHECK(cut("coucou", 2).size() == 3);
CHECK(cut("bonjour les copains", 6).size() == 4);
-} \ No newline at end of file
+ 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] == "♥");
+}