diff options
author | Jim Meyering <meyering@redhat.com> | 2011-05-21 12:13:08 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2011-05-21 12:13:08 +0200 |
commit | 2be2b8c044f8bd0fc6723004840029bd85078196 (patch) | |
tree | 959b2ff53d265f8b2a41cbe0d1bc8d66f21e8ade /tests | |
parent | 8e6d2371460706b0ad48ee476fb5cde7f4cd61ee (diff) | |
download | grep-2be2b8c044f8bd0fc6723004840029bd85078196.tar.gz |
tests: factor out a new require_pcre_ function
* tests/init.cfg (require_pcre_): New function, factored out of...
* tests/pcre-z: ...here. Use the function.
* tests/pcre: Likewise.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/init.cfg | 6 | ||||
-rw-r--r-- | tests/pcre | 4 | ||||
-rwxr-xr-x | tests/pcre-z | 4 |
3 files changed, 8 insertions, 6 deletions
diff --git a/tests/init.cfg b/tests/init.cfg index baa2b40f..4c9d2d33 100644 --- a/tests/init.cfg +++ b/tests/init.cfg @@ -43,6 +43,12 @@ require_timeout_() || skip_ your system lacks the timeout program } +require_pcre_() +{ + echo . | grep -P . 2>err || skip_ no PCRE support + compare err /dev/null || fail_ PCRE available, but stderr not empty. +} + # Some tests would fail without this particular locale. # If the locale is not available, just skip the test. require_en_utf8_locale_() @@ -8,9 +8,7 @@ # notice and this notice are preserved. . "${srcdir=.}/init.sh"; path_prepend_ ../src - -# Test that grep was compiled with HAVE_LIBPCRE. Otherwise, pass. -echo . | grep -P . || skip_ no PCRE support +require_pcre_ fail=0 diff --git a/tests/pcre-z b/tests/pcre-z index d1d5dd7d..94e9a78e 100755 --- a/tests/pcre-z +++ b/tests/pcre-z @@ -1,9 +1,7 @@ #!/bin/sh # Test Perl regex with NUL-separated input . "${srcdir=.}/init.sh"; path_prepend_ ../src - -echo a | grep -P a >/dev/null 2>err || skip_ 'PCRE not available.' -compare err /dev/null || fail_ 'PCRE available, but stderr not empty.' +require_pcre_ REGEX=a |