Browse Source
Git ships with a fall-back regexp implementation for platforms with buggy regexp library; give people a tool to see if they should be using it on their platform. * rj/test-regex: test-regex: Add a test to check for a bug in the regex routinesmaint
Junio C Hamano
13 years ago
4 changed files with 27 additions and 0 deletions
@ -0,0 +1,20 @@ |
|||||||
|
#include <git-compat-util.h> |
||||||
|
|
||||||
|
int main(int argc, char **argv) |
||||||
|
{ |
||||||
|
char *pat = "[^={} \t]+"; |
||||||
|
char *str = "={}\nfred"; |
||||||
|
regex_t r; |
||||||
|
regmatch_t m[1]; |
||||||
|
|
||||||
|
if (regcomp(&r, pat, REG_EXTENDED | REG_NEWLINE)) |
||||||
|
die("failed regcomp() for pattern '%s'", pat); |
||||||
|
if (regexec(&r, str, 1, m, 0)) |
||||||
|
die("no match of pattern '%s' to string '%s'", pat, str); |
||||||
|
|
||||||
|
/* http://sourceware.org/bugzilla/show_bug.cgi?id=3957 */ |
||||||
|
if (m[0].rm_so == 3) /* matches '\n' when it should not */ |
||||||
|
die("regex bug confirmed: re-build git with NO_REGEX=1"); |
||||||
|
|
||||||
|
exit(0); |
||||||
|
} |
Loading…
Reference in new issue