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).
This commit is contained in:
parent
507dfec781
commit
73a4901fe1
@ -42,7 +42,7 @@ Bug fixes::
|
|||||||
|
|
||||||
Tests::
|
Tests::
|
||||||
|
|
||||||
* unit: fix UTF-8 tests on FreeBSD
|
* unit: fix UTF-8 and evaluation tests on FreeBSD
|
||||||
* unit: add tests on IRC configuration and protocol functions
|
* unit: add tests on IRC configuration and protocol functions
|
||||||
|
|
||||||
Build::
|
Build::
|
||||||
|
@ -507,13 +507,13 @@ TEST(CoreEval, EvalReplaceRegex)
|
|||||||
|
|
||||||
/* add brackets around URLs (regex as string) */
|
/* add brackets around URLs (regex as string) */
|
||||||
hashtable_remove (pointers, "regex");
|
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} ]");
|
hashtable_set (options, "regex_replace", "[ ${re:0} ]");
|
||||||
WEE_CHECK_EVAL("test: [ https://weechat.org/ ]",
|
WEE_CHECK_EVAL("test: [ https://weechat.org/ ]",
|
||||||
"test: https://weechat.org/");
|
"test: https://weechat.org/");
|
||||||
|
|
||||||
/* add brackets around URLs (compiled regex) */
|
/* add brackets around URLs (compiled regex) */
|
||||||
LONGS_EQUAL(0, string_regcomp (®ex, "\\w+://\\S+",
|
LONGS_EQUAL(0, string_regcomp (®ex, "[a-zA-Z0-9_]+://[^ ]+",
|
||||||
REG_EXTENDED | REG_ICASE));
|
REG_EXTENDED | REG_ICASE));
|
||||||
hashtable_set (pointers, "regex", ®ex);
|
hashtable_set (pointers, "regex", ®ex);
|
||||||
hashtable_remove (options, "regex");
|
hashtable_remove (options, "regex");
|
||||||
@ -524,13 +524,13 @@ TEST(CoreEval, EvalReplaceRegex)
|
|||||||
|
|
||||||
/* hide passwords (regex as string) */
|
/* hide passwords (regex as string) */
|
||||||
hashtable_remove (pointers, "regex");
|
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}}");
|
hashtable_set (options, "regex_replace", "${re:1}${hide:*,${re:2}}");
|
||||||
WEE_CHECK_EVAL("password=*** password=***",
|
WEE_CHECK_EVAL("password=*** password=***",
|
||||||
"password=abc password=def");
|
"password=abc password=def");
|
||||||
|
|
||||||
/* hide passwords (compiled regex) */
|
/* hide passwords (compiled regex) */
|
||||||
LONGS_EQUAL(0, string_regcomp (®ex, "(password=)(\\S+)",
|
LONGS_EQUAL(0, string_regcomp (®ex, "(password=)([^ ]+)",
|
||||||
REG_EXTENDED | REG_ICASE));
|
REG_EXTENDED | REG_ICASE));
|
||||||
hashtable_set (pointers, "regex", ®ex);
|
hashtable_set (pointers, "regex", ®ex);
|
||||||
hashtable_remove (options, "regex");
|
hashtable_remove (options, "regex");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user