diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2019-01-13 02:05:58 +0000 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2019-05-19 11:12:13 +0100 |
commit | ca1b07a200eba27b34bc5b9131867936c5361396 (patch) | |
tree | bacda259b05c6b5e3a093ba6a23a82674bed4a69 | |
parent | aea9a7129bbe98efcda767619e47c140152e4156 (diff) | |
download | libgit2-ca1b07a200eba27b34bc5b9131867936c5361396.tar.gz |
tests: regcomp: test that regex functions succeed
The regex functions return nonzero (not necessarily negative values) on
failure.
-rw-r--r-- | tests/core/posix.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/core/posix.c b/tests/core/posix.c index 374373651..4514997d1 100644 --- a/tests/core/posix.c +++ b/tests/core/posix.c @@ -182,7 +182,7 @@ void test_core_posix__p_regcomp_ignores_global_locale_ctype(void) try_set_locale(LC_CTYPE); - cl_must_pass(p_regcomp(&preg, "[\xc0-\xff][\x80-\xbf]", P_REG_EXTENDED)); + cl_assert(!p_regcomp(&preg, "[\xc0-\xff][\x80-\xbf]", P_REG_EXTENDED)); p_regfree(&preg); } @@ -192,7 +192,7 @@ void test_core_posix__p_regcomp_ignores_global_locale_collate(void) p_regex_t preg; try_set_locale(LC_COLLATE); - cl_must_pass(p_regcomp(&preg, "[\xc0-\xff][\x80-\xbf]", P_REG_EXTENDED)); + cl_assert(!p_regcomp(&preg, "[\xc0-\xff][\x80-\xbf]", P_REG_EXTENDED)); p_regfree(&preg); } @@ -205,12 +205,12 @@ void test_core_posix__p_regcomp_matches_digits_with_locale(void) try_set_locale(LC_COLLATE); try_set_locale(LC_CTYPE); - cl_must_pass(p_regcomp(&preg, "[:digit:]", P_REG_EXTENDED)); + cl_assert(!p_regcomp(&preg, "[:digit:]", P_REG_EXTENDED)); str[1] = '\0'; for (c = '0'; c <= '9'; c++) { str[0] = c; - cl_must_pass(p_regexec(&preg, str, 0, NULL, 0)); + cl_assert(!p_regexec(&preg, str, 0, NULL, 0)); } p_regfree(&preg); @@ -224,16 +224,16 @@ void test_core_posix__p_regcomp_matches_alphabet_with_locale(void) try_set_locale(LC_COLLATE); try_set_locale(LC_CTYPE); - cl_must_pass(p_regcomp(&preg, "[:alpha:]", REG_EXTENDED)); + cl_assert(!p_regcomp(&preg, "[:alpha:]", REG_EXTENDED)); str[1] = '\0'; for (c = 'a'; c <= 'z'; c++) { str[0] = c; - cl_must_pass(p_regexec(&preg, str, 0, NULL, 0)); + cl_assert(!p_regexec(&preg, str, 0, NULL, 0)); } for (c = 'A'; c <= 'Z'; c++) { str[0] = c; - cl_must_pass(p_regexec(&preg, str, 0, NULL, 0)); + cl_assert(!p_regexec(&preg, str, 0, NULL, 0)); } p_regfree(&preg); @@ -250,11 +250,11 @@ void test_core_posix__p_regcomp_compile_userdiff_regexps(void) error = p_regcomp(&preg, ddef.fns, P_REG_EXTENDED | ddef.flags); p_regfree(&preg); - cl_must_pass(error); + cl_assert(!error); error = p_regcomp(&preg, ddef.words, P_REG_EXTENDED); p_regfree(&preg); - cl_must_pass(error); + cl_assert(!error); } } |