VirtualBox

source: kBuild/trunk/src/grep/tests/pcre-z

Last change on this file was 3529, checked in by bird, 3 years ago

Imported grep 3.7 from grep-3.7.tar.gz (sha256: c22b0cf2d4f6bbe599c902387e8058990e1eee99aef333a203829e5fd3dbb342), applying minimal auto-props.

  • Property svn:executable set to *
File size: 768 bytes
Line 
1#!/bin/sh
2# Test Perl regex with NUL-separated input
3. "${srcdir=.}/init.sh"; path_prepend_ ../src
4require_pcre_
5require_en_utf8_locale_
6
7REGEX=a
8
9printf '%s\n\0' abc def ghi aaa gah > in || framework_failure_
10
11grep -z "$REGEX" in > exp 2>err || fail_ 'Cannot do BRE (grep -z) match.'
12compare /dev/null err || fail_ 'stderr not empty on grep -z.'
13
14# Sanity check the output
15test "$(grep -cz $REGEX in 2>err)" = 3 \
16 || fail_ 'Incorrect BRE (grep -cz) match.'
17compare /dev/null err || fail_ 'stderr not empty on grep -cz.'
18
19fail=0
20grep -Pz "$REGEX" in > out 2>err || fail=1
21compare exp out || fail=1
22compare /dev/null err || fail=1
23
24printf '\303\200\0' >in0 # "À" followed by a NUL.
25LC_ALL=en_US.UTF-8 grep -z . in0 >out || fail=1
26cmp in0 out || fail=1
27
28Exit $fail
Note: See TracBrowser for help on using the repository browser.

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