From 4b1c580bb9bc03d656e59d702c72c3e793a1bbe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Wed, 15 Jun 2016 12:19:19 +0200 Subject: cut messages at 512 bytes, taking into account the UTF-8 codepoints ref #3067 --- tests/utils.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests/utils.cpp') 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] == "♥"); +} -- cgit v1.2.3