| Last change
 on this file since 3552 was             3529, checked in by bird, 4 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 | 
|---|
| 4 | require_pcre_ | 
|---|
| 5 | require_en_utf8_locale_ | 
|---|
| 6 |  | 
|---|
| 7 | REGEX=a | 
|---|
| 8 |  | 
|---|
| 9 | printf '%s\n\0' abc def ghi aaa gah > in || framework_failure_ | 
|---|
| 10 |  | 
|---|
| 11 | grep -z "$REGEX" in > exp 2>err || fail_ 'Cannot do BRE (grep -z) match.' | 
|---|
| 12 | compare /dev/null err || fail_ 'stderr not empty on grep -z.' | 
|---|
| 13 |  | 
|---|
| 14 | # Sanity check the output | 
|---|
| 15 | test "$(grep -cz $REGEX in 2>err)" = 3 \ | 
|---|
| 16 | || fail_ 'Incorrect BRE (grep -cz) match.' | 
|---|
| 17 | compare /dev/null err || fail_ 'stderr not empty on grep -cz.' | 
|---|
| 18 |  | 
|---|
| 19 | fail=0 | 
|---|
| 20 | grep -Pz "$REGEX" in > out 2>err || fail=1 | 
|---|
| 21 | compare exp out || fail=1 | 
|---|
| 22 | compare /dev/null err || fail=1 | 
|---|
| 23 |  | 
|---|
| 24 | printf '\303\200\0' >in0 # "Ã" followed by a NUL. | 
|---|
| 25 | LC_ALL=en_US.UTF-8 grep -z . in0 >out || fail=1 | 
|---|
| 26 | cmp in0 out || fail=1 | 
|---|
| 27 |  | 
|---|
| 28 | Exit $fail | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.