VirtualBox

source: kBuild/vendor/grep/2.12/tests/fmbtest@ 3627

Last change on this file since 3627 was 2595, checked in by bird, 13 years ago

gnu grep version 2.12 (grep-2.12.tar.xz, md5sum=8d2f0346d08b13c18afb81f0e8aa1e2f)

File size: 3.3 KB
Line 
1#! /bin/sh
2# Copyright (C) 2001, 2006, 2009-2012 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 | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'))"
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 | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'))"
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 | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'))"
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 grep -${mode}iw -f cspatfile csinput \
78# | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'))"
79#if test "$test4" != "01 02 08 13 17 19"; then
80# echo "Test #4 ${mode} failed: $test4"
81# failures=1
82#fi
83
84# Test that --color=always does not depend on individual pattern order within the pattern
85# list, and that a longer match is preferred to a shorter one starting at the same point.
86test6="$(echo 'Cosi tu ČišÍ...' \
87 | LC_ALL=$cz grep --color=always -${mode}i -e 'čiš' -e 'čiší')"
88if echo "$test6" | LC_ALL=C grep -q 'Cosi tu .*\[.*m\(.\[K\)\?ČišÍ.*\[.*m\(.\[K\)\?\.\.\.'; then
89 :
90else
91 echo "Test #6 ${mode} failed: $test6"
92 failures=1
93fi
94
95# Test that --color=always does not depend on individual pattern order within the pattern
96# list, and that a longer match is preferred to a shorter one starting at the same point.
97test7="$(echo 'Cosi tu ČišÍ...' \
98 | LC_ALL=$cz grep --color=always -${mode}i -e 'čiší' -e 'čiš')"
99if echo "$test7" | LC_ALL=C grep -q 'Cosi tu .*\[.*m\(.\[K\)\?ČišÍ.*\[.*m\(.\[K\)\?\.\.\.'; then
100 :
101else
102 echo "Test #7 ${mode} failed: $test7"
103 failures=1
104fi
105
106done
107
108for mode in G E; do
109
110test8="$(echo $(LC_ALL=$cz grep -${mode}i -e 'Č.šE' -e 'Č[a-f]s' csinput \
111 | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'))"
112if test "$test8" != "01 02 07 08 10 11 12 13 14 15 16 17 18 19 20"; then
113 echo "Test #8 ${mode} failed: $test8"
114 failures=1
115fi
116
117done
118
119Exit $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