VirtualBox

source: kBuild/vendor/grep/2.12/tests/pcre-z

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
4require_pcre_
5
6REGEX=a
7
8printf "%s\n0" abc def ghi aaa gah | tr 0 \\0 > in
9
10grep -z "$REGEX" in > exp 2>err || fail_ 'Cannot do BRE (grep -z) match.'
11compare /dev/null err || fail_ 'stderr not empty on grep -z.'
12
13# Sanity check the output
14test "$(grep -cz $REGEX in 2>err)" = 3 \
15 || fail_ 'Incorrect BRE (grep -cz) match.'
16compare /dev/null err || fail_ 'stderr not empty on grep -cz.'
17
18fail=0
19grep -Pz "$REGEX" in > out 2>err || fail=1
20compare exp out || fail=1
21compare /dev/null err || fail=1
22
23Exit $fail
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette