diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2015-06-30 20:25:35 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2015-06-30 20:25:35 +0200 |
commit | 9bf40517d3fdc48befec9ea4030338e8e98b1852 (patch) | |
tree | 0142fb829326ce8305217899ca9dd5a725100792 /tests/unit | |
parent | e92a63427f2f3d45646cf0ffc107cf3f0a279f84 (diff) | |
download | weechat-9bf40517d3fdc48befec9ea4030338e8e98b1852.zip |
api: add support of evaluated sub-strings and current date/time in function string_eval_expression() and command /eval
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/core/test-eval.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/unit/core/test-eval.cpp b/tests/unit/core/test-eval.cpp index 39deb4e0c..8b938e00a 100644 --- a/tests/unit/core/test-eval.cpp +++ b/tests/unit/core/test-eval.cpp @@ -24,6 +24,7 @@ extern "C" { #include <stdio.h> +#include <string.h> #include <regex.h> #include "src/core/wee-eval.h" #include "src/core/wee-config.h" @@ -198,6 +199,9 @@ TEST(Eval, EvalExpression) WEE_CHECK_EVAL("", "${}"); WEE_CHECK_EVAL("", "${xyz}"); + /* test eval of substring */ + WEE_CHECK_EVAL("\t", "${eval:${\\t}}"); + /* test value from extra_vars */ WEE_CHECK_EVAL("value", "${test}"); @@ -230,6 +234,15 @@ TEST(Eval, EvalExpression) /* test info */ WEE_CHECK_EVAL(version_get_version (), "${info:version}"); + /* test date */ + value = eval_expression ("${date}", pointers, extra_vars, options); + LONGS_EQUAL(19, strlen (value)); + free (value); + value = eval_expression ("${date:%H:%M:%S}", + pointers, extra_vars, options); + LONGS_EQUAL(8, strlen (value)); + free (value); + /* test option */ snprintf (str_value, sizeof (str_value), "%d", CONFIG_INTEGER(config_look_scroll_amount)); |