summaryrefslogtreecommitdiff
path: root/tests/unit/core
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2022-10-03 20:56:12 +0200
committerSébastien Helleu <flashcode@flashtux.org>2022-11-05 22:34:38 +0100
commit196a0511418a7a1f406db45d23abd4697ad7f905 (patch)
tree85cac7f2989f04222823f1910438bf40ea415907 /tests/unit/core
parentbc2fb071e22589aa219ce551b0112bacbd3cca8f (diff)
downloadweechat-196a0511418a7a1f406db45d23abd4697ad7f905.zip
core: add range of chars in evaluation of expressions with `chars:xxx`
Diffstat (limited to 'tests/unit/core')
-rw-r--r--tests/unit/core/test-core-eval.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/unit/core/test-core-eval.cpp b/tests/unit/core/test-core-eval.cpp
index e1d9a3cff..248c680fe 100644
--- a/tests/unit/core/test-core-eval.cpp
+++ b/tests/unit/core/test-core-eval.cpp
@@ -516,6 +516,25 @@ TEST(CoreEval, EvalExpression)
WEE_CHECK_EVAL("\t", "${\\t}");
WEE_CHECK_EVAL("\t", "${esc:\t}");
+ /* test range of chars */
+ WEE_CHECK_EVAL("0123456789", "${chars:digit}");
+ WEE_CHECK_EVAL("0123456789abcdefABCDEF", "${chars:xdigit}");
+ WEE_CHECK_EVAL("abcdefghijklmnopqrstuvwxyz", "${chars:lower}");
+ WEE_CHECK_EVAL("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "${chars:upper}");
+ WEE_CHECK_EVAL("abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "${chars:alpha}");
+ WEE_CHECK_EVAL("abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789", "${chars:alnum}");
+ WEE_CHECK_EVAL("0123456789", "${chars:0-9}");
+ WEE_CHECK_EVAL("abcdefgh", "${chars:a-h}");
+ WEE_CHECK_EVAL("JKLMNOPQRSTUV", "${chars:J-V}");
+ WEE_CHECK_EVAL("é", "${chars:é-é}");
+ WEE_CHECK_EVAL("àáâãäåæçèé", "${chars:à-é}");
+ WEE_CHECK_EVAL("←↑→↓", "${chars:←-↓}"); /* U+2190 - U+2193 */
+ WEE_CHECK_EVAL("▁▂▃▄▅▆▇█▉▊▋▌▍▎▏", "${chars:▁-▏}"); /* U+2581 - U+258F */
+ WEE_CHECK_EVAL("", "${chars:Z-A}"); /* invalid (reverse) */
+
/* test case conversion: to lower case */
WEE_CHECK_EVAL("", "${lower:}");
WEE_CHECK_EVAL("this is a test", "${lower:This is a TEST}");