Skip to content

Commit ca1b07a

Browse files
committed
tests: regcomp: test that regex functions succeed
The regex functions return nonzero (not necessarily negative values) on failure.
1 parent aea9a71 commit ca1b07a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tests/core/posix.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ void test_core_posix__p_regcomp_ignores_global_locale_ctype(void)
182182

183183
try_set_locale(LC_CTYPE);
184184

185-
cl_must_pass(p_regcomp(&preg, "[\xc0-\xff][\x80-\xbf]", P_REG_EXTENDED));
185+
cl_assert(!p_regcomp(&preg, "[\xc0-\xff][\x80-\xbf]", P_REG_EXTENDED));
186186

187187
p_regfree(&preg);
188188
}
@@ -192,7 +192,7 @@ void test_core_posix__p_regcomp_ignores_global_locale_collate(void)
192192
p_regex_t preg;
193193

194194
try_set_locale(LC_COLLATE);
195-
cl_must_pass(p_regcomp(&preg, "[\xc0-\xff][\x80-\xbf]", P_REG_EXTENDED));
195+
cl_assert(!p_regcomp(&preg, "[\xc0-\xff][\x80-\xbf]", P_REG_EXTENDED));
196196

197197
p_regfree(&preg);
198198
}
@@ -205,12 +205,12 @@ void test_core_posix__p_regcomp_matches_digits_with_locale(void)
205205
try_set_locale(LC_COLLATE);
206206
try_set_locale(LC_CTYPE);
207207

208-
cl_must_pass(p_regcomp(&preg, "[:digit:]", P_REG_EXTENDED));
208+
cl_assert(!p_regcomp(&preg, "[:digit:]", P_REG_EXTENDED));
209209

210210
str[1] = '\0';
211211
for (c = '0'; c <= '9'; c++) {
212212
str[0] = c;
213-
cl_must_pass(p_regexec(&preg, str, 0, NULL, 0));
213+
cl_assert(!p_regexec(&preg, str, 0, NULL, 0));
214214
}
215215

216216
p_regfree(&preg);
@@ -224,16 +224,16 @@ void test_core_posix__p_regcomp_matches_alphabet_with_locale(void)
224224
try_set_locale(LC_COLLATE);
225225
try_set_locale(LC_CTYPE);
226226

227-
cl_must_pass(p_regcomp(&preg, "[:alpha:]", REG_EXTENDED));
227+
cl_assert(!p_regcomp(&preg, "[:alpha:]", REG_EXTENDED));
228228

229229
str[1] = '\0';
230230
for (c = 'a'; c <= 'z'; c++) {
231231
str[0] = c;
232-
cl_must_pass(p_regexec(&preg, str, 0, NULL, 0));
232+
cl_assert(!p_regexec(&preg, str, 0, NULL, 0));
233233
}
234234
for (c = 'A'; c <= 'Z'; c++) {
235235
str[0] = c;
236-
cl_must_pass(p_regexec(&preg, str, 0, NULL, 0));
236+
cl_assert(!p_regexec(&preg, str, 0, NULL, 0));
237237
}
238238

239239
p_regfree(&preg);
@@ -250,11 +250,11 @@ void test_core_posix__p_regcomp_compile_userdiff_regexps(void)
250250

251251
error = p_regcomp(&preg, ddef.fns, P_REG_EXTENDED | ddef.flags);
252252
p_regfree(&preg);
253-
cl_must_pass(error);
253+
cl_assert(!error);
254254

255255
error = p_regcomp(&preg, ddef.words, P_REG_EXTENDED);
256256
p_regfree(&preg);
257-
cl_must_pass(error);
257+
cl_assert(!error);
258258
}
259259
}
260260

0 commit comments

Comments
 (0)