diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-22 04:38:07 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-22 04:38:07 +0000 |
commit | 28ef1abc10cfbc2c3d2747c008eb2300858d0426 (patch) | |
tree | 41208fb8f393e6cb6cc8f939623ad47a0db17876 /tests/pcre-context | |
download | grep-tarball-master.tar.gz |
Diffstat (limited to 'tests/pcre-context')
-rwxr-xr-x | tests/pcre-context | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/pcre-context b/tests/pcre-context new file mode 100755 index 0000000..b910a20 --- /dev/null +++ b/tests/pcre-context @@ -0,0 +1,36 @@ +#!/bin/sh +# Test Perl regex with context +. "${srcdir=.}/init.sh"; path_prepend_ ../src +require_pcre_ + +cat >in <<'EOF' +Preceded by 0 empty lines. + +Preceded by 1 empty line. + + +Preceded by 2 empty lines. + + + +Preceded by 3 empty lines. + + + + +Preceded by 4 empty lines. + +EOF +test $? -eq 0 || framework_failure_ + +printf '%s\0' \ + 'Preceded by 2 empty lines.' \ + 'Preceded by 3 empty lines.' \ + 'Preceded by 4 empty lines.' >exp || framework_failure_ + +fail=0 + +grep -Pzo '(?<=\n\n\n).*' in >out || fail_ 'grep -Pzo failed' +compare exp out || fail=1 + +Exit $fail |