|
Last change
on this file was 2595, checked in by bird, 12 years ago |
|
gnu grep version 2.12 (grep-2.12.tar.xz, md5sum=8d2f0346d08b13c18afb81f0e8aa1e2f)
|
|
File size:
610 bytes
|
| Line | |
|---|
| 1 | #!/bin/sh
|
|---|
| 2 | # Test Perl regex with NUL-separated input
|
|---|
| 3 | . "${srcdir=.}/init.sh"; path_prepend_ ../src
|
|---|
| 4 | require_pcre_
|
|---|
| 5 |
|
|---|
| 6 | REGEX=a
|
|---|
| 7 |
|
|---|
| 8 | printf "%s\n0" abc def ghi aaa gah | tr 0 \\0 > in
|
|---|
| 9 |
|
|---|
| 10 | grep -z "$REGEX" in > exp 2>err || fail_ 'Cannot do BRE (grep -z) match.'
|
|---|
| 11 | compare /dev/null err || fail_ 'stderr not empty on grep -z.'
|
|---|
| 12 |
|
|---|
| 13 | # Sanity check the output
|
|---|
| 14 | test "$(grep -cz $REGEX in 2>err)" = 3 \
|
|---|
| 15 | || fail_ 'Incorrect BRE (grep -cz) match.'
|
|---|
| 16 | compare /dev/null err || fail_ 'stderr not empty on grep -cz.'
|
|---|
| 17 |
|
|---|
| 18 | fail=0
|
|---|
| 19 | grep -Pz "$REGEX" in > out 2>err || fail=1
|
|---|
| 20 | compare exp out || fail=1
|
|---|
| 21 | compare /dev/null err || fail=1
|
|---|
| 22 |
|
|---|
| 23 | Exit $fail
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.