VirtualBox

source: kBuild/trunk/src/grep/tests/fmbtest@ 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: 3.2 KB
Line 
1#! /bin/sh
2# Copyright (C) 2001, 2006, 2009-2021 Free Software Foundation, Inc.
3#
4# Copying and distribution of this file, with or without modification,
5# are permitted in any medium without royalty provided the copyright
6# notice and this notice are preserved.
7
8. "${srcdir=.}/init.sh"; path_prepend_ ../src
9
10cz=cs_CZ.UTF-8
11
12# If cs_CZ.UTF-8 locale doesn't work, skip this test.
13LC_ALL=$cz locale -k LC_CTYPE 2>/dev/null | grep -q charmap.*UTF-8 \
14 || skip_ this system lacks the $cz locale
15
16# If matching is done in single-byte mode, skip this test too
17printf 'é\n' | LC_ALL=$cz grep -Eq '^[é]{2}$'
18case $? in
19 0) skip_ "built without multi-byte support";;
20 1) ;;
21 *) fail_ "unexpected exit status: $?";;
22esac
23
24failures=0
25
26cat > csinput <<EOF
2701 Žluťoučká číše
28ČíŠE 02
2903 Z číší Čiší cosi
3004 Čí
31Še 05
3206 ČČČČČČČíšČÍŠčíš
3307 ČČČ ČČČČíšČÍŠčíšEEEE
34čAs 08
3509Čapka
3610ČaSy se měnÍ
37ČÍšE11
38Čas12
39𝇕ČÍšE𝇓13
40ŽČÍšE𝇓14
41𝇕ČÍšEŽ15
42ŽČÍšEŽ16
43ČÍšE𝇓17
44ČÍšEŽ18
4519𝇕ČÍše
4620ŽČÍše
47EOF
48cat > cspatfile <<EOF
49ČÍšE
50Čas
51EOF
52
53for mode in F G E; do
54
55test1=$(echo $(LC_ALL=$cz grep -${mode} -f cspatfile csinput |
56 tr -cs '0-9' '[ *]'))
57if test "$test1" != "11 12 13 14 15 16 17 18"; then
58 echo "Test #1 ${mode} failed: $test1"
59 failures=1
60fi
61
62test2=$(echo $(LC_ALL=$cz grep -${mode}i -f cspatfile csinput |
63 tr -cs '0-9' '[ *]'))
64if test "$test2" != "01 02 07 08 10 11 12 13 14 15 16 17 18 19 20"; then
65 echo "Test #2 ${mode} failed: $test2"
66 failures=1
67fi
68
69test3=$(echo $(LC_ALL=$cz grep -${mode}i -e 'ČÍšE' -e 'Čas' csinput |
70 tr -cs '0-9' '[ *]'))
71if test "$test3" != "01 02 07 08 10 11 12 13 14 15 16 17 18 19 20"; then
72 echo "Test #3 ${mode} failed: $test3"
73 failures=1
74fi
75
76# Skip the next test - known to fail. TAA.
77#test4=$(echo $(LC_ALL=$cz; export LC_ALL
78# grep -${mode}iw -f cspatfile csinput |
79# sed 's/[^0123456789]/ /g'))
80#if test "$test4" != "01 02 08 13 17 19"; then
81# echo "Test #4 ${mode} failed: $test4"
82# failures=1
83#fi
84
85# Test that --color=always does not depend on individual pattern order
86# within the pattern list, and that a longer match is preferred to a
87# shorter one starting at the same point.
88test6="$(echo 'Cosi tu ČišÍ...' \
89 | LC_ALL=$cz grep --color=always -${mode}i -e 'čiš' -e 'čiší')"
90if echo "$test6" \
91 | LC_ALL=C grep -q 'Cosi tu .*\[.*m\(.\[K\)\?ČišÍ.*\[.*m\(.\[K\)\?\.\.\.'; \
92then
93 :
94else
95 echo "Test #6 ${mode} failed: $test6"
96 failures=1
97fi
98
99# Test that --color=always does not depend on individual pattern order
100# within the pattern list, and that a longer match is preferred to a
101# shorter one starting at the same point.
102test7="$(echo 'Cosi tu ČišÍ...' \
103 | LC_ALL=$cz grep --color=always -${mode}i -e 'čiší' -e 'čiš')"
104if echo "$test7" \
105 | LC_ALL=C grep -q 'Cosi tu .*\[.*m\(.\[K\)\?ČišÍ.*\[.*m\(.\[K\)\?\.\.\.'; \
106then
107 :
108else
109 echo "Test #7 ${mode} failed: $test7"
110 failures=1
111fi
112
113done
114
115for mode in G E; do
116
117test8=$(echo $(LC_ALL=$cz grep -${mode}i -e 'Č.šE' -e 'Č[a-f]s' csinput |
118 tr -cs '0-9' '[ *]'))
119if test "$test8" != "01 02 07 08 10 11 12 13 14 15 16 17 18 19 20"; then
120 echo "Test #8 ${mode} failed: $test8"
121 failures=1
122fi
123
124done
125
126Exit $failures
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