summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2017-03-27 21:14:51 +0200
committerSébastien Helleu <flashcode@flashtux.org>2017-03-27 21:14:51 +0200
commitf99c866f352c9bc7f3ba0e7d228a5942dd616de0 (patch)
tree3180f347e130d6b41e9863902fe8404d5a28e4a4 /tests
parentf37ecbfefd63d1966a877b3999ab472147282e77 (diff)
downloadweechat-f99c866f352c9bc7f3ba0e7d228a5942dd616de0.zip
core: add cut of string with max chars displayed in evaluation of expressions
The syntax is: ${cutscr:max,suffix,string}. The string is cut after max chars displayed on screen. If the string is cut, the optional suffix is added after.
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.cpp4
-rw-r--r--tests/unit/core/test-eval.cpp2
-rw-r--r--tests/unit/core/test-utf8.cpp3
3 files changed, 5 insertions, 4 deletions
diff --git a/tests/tests.cpp b/tests/tests.cpp
index ceda4144d..098feea65 100644
--- a/tests/tests.cpp
+++ b/tests/tests.cpp
@@ -126,8 +126,8 @@ main (int argc, char *argv[])
int rc, length, weechat_argc;
char *weechat_tests_args, *args, **weechat_argv;
- /* setup environment: default language, no specific timezone */
- setenv ("LC_ALL", "C", 1);
+ /* setup environment: English language, no specific timezone */
+ setenv ("LC_ALL", "en_US.UTF-8", 1);
setenv ("TZ", "", 1);
/* build arguments for WeeChat */
diff --git a/tests/unit/core/test-eval.cpp b/tests/unit/core/test-eval.cpp
index 92914f8d4..78b805119 100644
--- a/tests/unit/core/test-eval.cpp
+++ b/tests/unit/core/test-eval.cpp
@@ -227,6 +227,8 @@ TEST(Eval, EvalExpression)
WEE_CHECK_EVAL("te+", "${cut:2,+,test}");
WEE_CHECK_EVAL("éà", "${cut:2,,éàô}");
WEE_CHECK_EVAL("éà+", "${cut:2,+,éàô}");
+ WEE_CHECK_EVAL("こん+", "${cut:2,+,こんにちは世界}");
+ WEE_CHECK_EVAL("こ+", "${cutscr:2,+,こんにちは世界}");
/* test color */
WEE_CHECK_EVAL(gui_color_get_custom ("green"), "${color:green}");
diff --git a/tests/unit/core/test-utf8.cpp b/tests/unit/core/test-utf8.cpp
index 1bdf9b427..ca8ccfd22 100644
--- a/tests/unit/core/test-utf8.cpp
+++ b/tests/unit/core/test-utf8.cpp
@@ -354,8 +354,7 @@ TEST(Utf8, Size)
LONGS_EQUAL(1, utf8_char_size_screen ("A"));
LONGS_EQUAL(1, utf8_char_size_screen ("ë"));
LONGS_EQUAL(1, utf8_char_size_screen ("€"));
- /* this test does not work on Ubuntu Precise: it returns 2 instead of 1 */
- /*LONGS_EQUAL(1, utf8_char_size_screen (han_char));*/
+ LONGS_EQUAL(2, utf8_char_size_screen (han_char));
/* length of string (in chars) */
LONGS_EQUAL(0, utf8_strlen (NULL));