summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2019-01-26 10:00:47 +0100
committerSébastien Helleu <flashcode@flashtux.org>2019-01-26 10:00:47 +0100
commit73a4901fe1f3ed884efcbb49d204d1466215f89c (patch)
tree112033cfb6fbed9f0359b77959448db829e16d2a /tests/unit
parent507dfec7819e1cdb8e7b1c73edd987d8ee70603f (diff)
downloadweechat-73a4901fe1f3ed884efcbb49d204d1466215f89c.zip
tests: fix evaluation tests on FreeBSD
The following special sequences are not supported in regular expressions on FreeBSD: - "\w": replaced with "[a-zA-Z0-9_]" - "\S": replaced with "[^ ]" (it should be "[^ \t\n\r\f\v]", but in practice only spaces could be a problem when we use this sequence).
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/core/test-core-eval.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/unit/core/test-core-eval.cpp b/tests/unit/core/test-core-eval.cpp
index 4f2a90e9e..f0e333b79 100644
--- a/tests/unit/core/test-core-eval.cpp
+++ b/tests/unit/core/test-core-eval.cpp
@@ -507,13 +507,13 @@ TEST(CoreEval, EvalReplaceRegex)
/* add brackets around URLs (regex as string) */
hashtable_remove (pointers, "regex");
- hashtable_set (options, "regex", "\\w+://\\S+");
+ hashtable_set (options, "regex", "[a-zA-Z0-9_]+://[^ ]+");
hashtable_set (options, "regex_replace", "[ ${re:0} ]");
WEE_CHECK_EVAL("test: [ https://weechat.org/ ]",
"test: https://weechat.org/");
/* add brackets around URLs (compiled regex) */
- LONGS_EQUAL(0, string_regcomp (&regex, "\\w+://\\S+",
+ LONGS_EQUAL(0, string_regcomp (&regex, "[a-zA-Z0-9_]+://[^ ]+",
REG_EXTENDED | REG_ICASE));
hashtable_set (pointers, "regex", &regex);
hashtable_remove (options, "regex");
@@ -524,13 +524,13 @@ TEST(CoreEval, EvalReplaceRegex)
/* hide passwords (regex as string) */
hashtable_remove (pointers, "regex");
- hashtable_set (options, "regex", "(password=)(\\S+)");
+ hashtable_set (options, "regex", "(password=)([^ ]+)");
hashtable_set (options, "regex_replace", "${re:1}${hide:*,${re:2}}");
WEE_CHECK_EVAL("password=*** password=***",
"password=abc password=def");
/* hide passwords (compiled regex) */
- LONGS_EQUAL(0, string_regcomp (&regex, "(password=)(\\S+)",
+ LONGS_EQUAL(0, string_regcomp (&regex, "(password=)([^ ]+)",
REG_EXTENDED | REG_ICASE));
hashtable_set (pointers, "regex", &regex);
hashtable_remove (options, "regex");