summaryrefslogtreecommitdiff
path: root/tests/unit/core/test-core-eval.cpp
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2021-09-18 14:56:25 +0200
committerSébastien Helleu <flashcode@flashtux.org>2021-09-20 21:15:28 +0200
commita6826af796c2809681dec21e7d9dcbd9896ffe42 (patch)
tree2e803d9d349e36a213964f348e9d358671f8d851 /tests/unit/core/test-core-eval.cpp
parentbd21b25badd72dbec7723ca002663ba38e3e07c9 (diff)
downloadweechat-a6826af796c2809681dec21e7d9dcbd9896ffe42.zip
core: add creation of user variables in evaluated expressions with ${define:name,value}
Diffstat (limited to 'tests/unit/core/test-core-eval.cpp')
-rw-r--r--tests/unit/core/test-core-eval.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/unit/core/test-core-eval.cpp b/tests/unit/core/test-core-eval.cpp
index 6e9582ca9..d5d1906d2 100644
--- a/tests/unit/core/test-core-eval.cpp
+++ b/tests/unit/core/test-core-eval.cpp
@@ -853,6 +853,14 @@ TEST(CoreEval, EvalExpression)
WEE_CHECK_EVAL("", "${translate:}");
WEE_CHECK_EVAL("abcdef", "${translate:abcdef}");
+ /* test user variables */
+ WEE_CHECK_EVAL("", "${define:}");
+ WEE_CHECK_EVAL("", "${define:test}");
+ WEE_CHECK_EVAL("", "${define:test,value}");
+ WEE_CHECK_EVAL("value", "${define:test,value}${test}");
+ WEE_CHECK_EVAL("8", "${define:test,${calc:5+3}}${test}");
+ WEE_CHECK_EVAL("value", "${define:buffer,value}${buffer}");
+
/* test option */
hashtable_set (secure_hashtable_data, "sec_option", "sec_value");
WEE_CHECK_EVAL("sec_value", "${sec.data.sec_option}");