diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2017-03-14 07:25:03 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2017-03-25 14:19:48 +0100 |
commit | 9a8ec36cbda56dfd255a21d8b185e5361162dbfc (patch) | |
tree | 9e8dc904cb82f17fdd7967eac135b802e4d94e48 /tests/unit/core | |
parent | db0ecc07fe138adf9f44705f6f4167ebd003e2e0 (diff) | |
download | weechat-9a8ec36cbda56dfd255a21d8b185e5361162dbfc.zip |
core: add cut of string in evaluation of expressions
The syntax is: ${cut:max,suffix,string}.
The string is cut after max chars. If the string is cut, the optional suffix is
added after.
Diffstat (limited to 'tests/unit/core')
-rw-r--r-- | tests/unit/core/test-eval.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/unit/core/test-eval.cpp b/tests/unit/core/test-eval.cpp index e2ecd401a..92914f8d4 100644 --- a/tests/unit/core/test-eval.cpp +++ b/tests/unit/core/test-eval.cpp @@ -218,6 +218,16 @@ TEST(Eval, EvalExpression) WEE_CHECK_EVAL("********", "${hide:*,password}"); WEE_CHECK_EVAL("\u2603\u2603\u2603", "${hide:${esc:\u2603},abc}"); + /* test cut of chars */ + WEE_CHECK_EVAL("", "${cut:0,,}"); + WEE_CHECK_EVAL("", "${cut:0,+,}"); + WEE_CHECK_EVAL("", "${cut:0,,test}"); + WEE_CHECK_EVAL("+", "${cut:0,+,test}"); + WEE_CHECK_EVAL("te", "${cut:2,,test}"); + WEE_CHECK_EVAL("te+", "${cut:2,+,test}"); + WEE_CHECK_EVAL("éà", "${cut:2,,éàô}"); + WEE_CHECK_EVAL("éà+", "${cut:2,+,éàô}"); + /* test color */ WEE_CHECK_EVAL(gui_color_get_custom ("green"), "${color:green}"); WEE_CHECK_EVAL(gui_color_get_custom ("*214"), "${color:*214}"); |