summaryrefslogtreecommitdiff
path: root/tests/unit/core
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/core')
-rw-r--r--tests/unit/core/test-eval.cpp13
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));