summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/core/test-core-eval.cpp3
-rw-r--r--tests/unit/core/test-core-string.cpp21
2 files changed, 16 insertions, 8 deletions
diff --git a/tests/unit/core/test-core-eval.cpp b/tests/unit/core/test-core-eval.cpp
index 4c0163511..faae52eff 100644
--- a/tests/unit/core/test-core-eval.cpp
+++ b/tests/unit/core/test-core-eval.cpp
@@ -988,7 +988,8 @@ TEST(CoreEval, EvalExpression)
hashtable_set (pointers, "my_null_pointer", (const void *)0x0);
hashtable_set (pointers, "my_buffer_pointer", gui_buffers);
hashtable_set (pointers, "my_other_pointer", (const void *)0x1234abcd);
- WEE_CHECK_EVAL("x", "x${buffer.number");
+ WEE_CHECK_EVAL("x", "x${buffer.numbe");
+ WEE_CHECK_EVAL("x1", "x${buffer.number");
WEE_CHECK_EVAL("x${buffer.number}1",
"x\\${buffer.number}${buffer.number}");
WEE_CHECK_EVAL("1", "${buffer.number}");
diff --git a/tests/unit/core/test-core-string.cpp b/tests/unit/core/test-core-string.cpp
index a3e22ee2c..ea760feb3 100644
--- a/tests/unit/core/test-core-string.cpp
+++ b/tests/unit/core/test-core-string.cpp
@@ -1308,20 +1308,23 @@ TEST(CoreString, Highlight)
/*
* Test callback for function string_replace_with_callback.
*
- * It replaces "abc" by "def", "xxx" by empty string, and for any other value
+ * It replaces "abc" by "def", "empty" by empty string, and for any other value
* it returns NULL (so the value is kept as-is).
*/
char *
-test_replace_cb (void *data, const char *text)
+test_replace_cb (void *data,
+ const char *prefix, const char *text, const char *suffix)
{
/* make C++ compiler happy */
(void) data;
+ (void) prefix;
+ (void) suffix;
if (strcmp (text, "abc") == 0)
return strdup ("def");
- if (strcmp (text, "xxx") == 0)
+ if (strcmp (text, "empty") == 0)
return strdup ("");
if (strncmp (text, "no_replace:", 11) == 0)
@@ -1446,13 +1449,17 @@ TEST(CoreString, ReplaceWithCallback)
&test_replace_cb, NULL, &errors);
WEE_REPLACE_CB("test def", 0, "test ${abc}", "${", "}", NULL,
&test_replace_cb, NULL, &errors);
- WEE_REPLACE_CB("test ", 0, "test ${xxx}", "${", "}", NULL,
+ WEE_REPLACE_CB("test ", 0, "test ${empty}", "${", "}", NULL,
+ &test_replace_cb, NULL, &errors);
+ WEE_REPLACE_CB("test ${aaa", 1, "test ${aaa", "${", "}", NULL,
+ &test_replace_cb, NULL, &errors);
+ WEE_REPLACE_CB("test ", 0, "test ${empty", "${", "}", NULL,
&test_replace_cb, NULL, &errors);
WEE_REPLACE_CB("test ${aaa}", 1, "test ${aaa}", "${", "}", NULL,
&test_replace_cb, NULL, &errors);
- WEE_REPLACE_CB("test def ${aaa}", 1, "test ${abc} ${xxx} ${aaa}",
+ WEE_REPLACE_CB("test def ${aaa}", 1, "test ${abc} ${empty} ${aaa}",
"${", "}", NULL, &test_replace_cb, NULL, &errors);
- WEE_REPLACE_CB("test ", 1, "test ${abc", "${", "}", NULL,
+ WEE_REPLACE_CB("test def", 0, "test ${abc", "${", "}", NULL,
&test_replace_cb, NULL, &errors);
WEE_REPLACE_CB("test abc}", 0, "test abc}", "${", "}", NULL,
&test_replace_cb, NULL, &errors);
@@ -1462,7 +1469,7 @@ TEST(CoreString, ReplaceWithCallback)
&test_replace_cb, NULL, &errors);
WEE_REPLACE_CB("def", 0, "${abc}", "${", "}", NULL,
&test_replace_cb, NULL, &errors);
- WEE_REPLACE_CB("", 0, "${xxx}", "${", "}", NULL,
+ WEE_REPLACE_CB("", 0, "${empty}", "${", "}", NULL,
&test_replace_cb, NULL, &errors);
WEE_REPLACE_CB("${aaa}", 1, "${aaa}", "${", "}", NULL,
&test_replace_cb, NULL, &errors);