VirtualBox

source: kBuild/trunk/src/grep/tests/prefix-of-multibyte@ 3646

Last change on this file since 3646 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: 1.1 KB
Line 
1#!/bin/sh
2# This would mistakenly print a line prior to grep-2.18.
3. "${srcdir=.}/init.sh"; path_prepend_ ../src
4
5require_en_utf8_locale_
6require_compiled_in_MB_support
7
8encode() { echo "$1" | tr ABC '\357\274\241'; }
9
10encode ABC >exp1
11encode aABC >exp2
12encode ABCABC >exp3
13encode _____________________ABCABC___ >exp4
14
15fail=0
16
17for LOC in en_US.UTF-8 $LOCALE_FR_UTF8; do
18 for pat in A aA BCA; do
19 for file in exp1 exp2 exp3 exp4; do
20 for type in regex dfa fgrep; do
21 case $type in
22 dfa) opt= prefix= ;;
23 fgrep) opt=-F prefix= ;;
24 regex) opt= prefix='\(\)\1' ;;
25 esac
26 pattern=$prefix$(encode $pat)
27 out=out-$type-$LOC
28 LC_ALL=$LOC grep $opt "$pattern" $file >$out
29 status=$?
30 echo $status >$out.status
31 if test $status -eq 0; then
32 compare $file $out
33 elif test $status -eq 1; then
34 compare_dev_null_ /dev/null $out
35 else
36 test $status -eq 2
37 fi || fail=1
38 compare out-regex-$LOC.status $out.status || fail=1
39 done
40 done
41 done
42done
43
44Exit $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