summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2019-10-06 09:13:35 +0200
committerSébastien Helleu <flashcode@flashtux.org>2019-10-06 09:13:35 +0200
commit88aa82d67256f95051c77acf2ce6e0f3bb4edbac (patch)
tree13afb4c751f96d08824356ef3acd5c0d6826f492 /tests
parent1a0ba4a9dc56c0de9655390b13d91d2cdddf37a3 (diff)
downloadweechat-88aa82d67256f95051c77acf2ce6e0f3bb4edbac.zip
core: add support of modifiers in evaluation of expressions with "modifier:name,data,string" (issue #60)
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/core/test-core-eval.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/unit/core/test-core-eval.cpp b/tests/unit/core/test-core-eval.cpp
index 65b2e6fed..80476733e 100644
--- a/tests/unit/core/test-core-eval.cpp
+++ b/tests/unit/core/test-core-eval.cpp
@@ -392,6 +392,20 @@ TEST(CoreEval, EvalExpression)
WEE_CHECK_EVAL(str_value, "${color:irc.color.message_join}-test-");
WEE_CHECK_EVAL("test", "${option.not.found}test");
+ /* test modifier */
+ WEE_CHECK_EVAL("test_string", "test_${modifier:xxx,data,string}");
+ WEE_CHECK_EVAL("test_no_color",
+ "${modifier:color_decode_ansi,0,test_\x1B[92mno_color}");
+ snprintf (str_value, sizeof (str_value),
+ "test_%slightgreen",
+ gui_color_get_custom ("lightgreen"));
+ WEE_CHECK_EVAL(str_value,
+ "${modifier:color_decode_ansi,1,test_\x1B[92mlightgreen}");
+ snprintf (str_value, sizeof (str_value),
+ "${modifier:color_encode_ansi,,test_%slightgreen}",
+ gui_color_get_custom ("lightgreen"));
+ WEE_CHECK_EVAL("test_\x1B[92mlightgreen", str_value);
+
/* test info */
WEE_CHECK_EVAL(version_get_version (), "${info:version}");