projects
/
libc-test
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2113a3e
)
fix BRE \0 test case
author
Szabolcs Nagy
<nsz@port70.net>
Sun, 22 Mar 2015 19:00:24 +0000
(19:00 +0000)
committer
Szabolcs Nagy
<nsz@port70.net>
Sun, 22 Mar 2015 19:00:24 +0000
(19:00 +0000)
src/regression/regex-backref-0.c
patch
|
blob
|
history
diff --git
a/src/regression/regex-backref-0.c
b/src/regression/regex-backref-0.c
index
c5f20b5
..
289be3b
100644
(file)
--- a/
src/regression/regex-backref-0.c
+++ b/
src/regression/regex-backref-0.c
@@
-1,4
+1,5
@@
-// \0 is not a valid backref
+// \0 is not a valid backref, it is undefined by the standard
+// we treat such cases as literal char
#include <regex.h>
#include "test.h"
#include <regex.h>
#include "test.h"
@@
-10,10
+11,15
@@
int main(void)
int n;
n = regcomp(&r, pat, 0);
int n;
n = regcomp(&r, pat, 0);
- // standard allows REG_BADPAT for all pattern errors
- if (n != REG_ESUBREG && n != REG_BADPAT) {
+ if (n) {
regerror(n, &r, buf, sizeof buf);
regerror(n, &r, buf, sizeof buf);
- t_error("regcomp(%s) returned %d (%s) wanted REG_ESUBREG\n", pat, n, buf);
+ t_error("regcomp(%s) returned %d (%s) wanted 0\n", pat, n, buf);
+ }
+ n = regexec(&r, "a0", 0, 0, 0);
+ if (n) {
+ regerror(n, &r, buf, sizeof buf);
+ t_error("regexec(/%s/ ~ \"a0\") returned %d (%s), wanted 0\n",
+ pat, n, buf);
}
return t_status;
}
return t_status;