VirtualBox

source: kBuild/trunk/src/grep/tests/turkish-I-without-dot

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: 1.8 KB
Line 
1#!/bin/sh
2# grep -i would misbehave for any matched line containing a character
3# (like "I" in the tr_TR.utf8 locale) whose lower-case representation
4# occupies more bytes (two in this case, for 0xc4b1, aka U+0131).
5
6# Copyright (C) 2011-2021 Free Software Foundation, Inc.
7
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17
18# You should have received a copy of the GNU General Public License
19# along with this program. If not, see <https://www.gnu.org/licenses/>.
20
21. "${srcdir=.}/init.sh"; path_prepend_ ../src
22
23require_tr_utf8_locale_
24require_compiled_in_MB_support
25
26# Before this change, grep could print a lot of uninitialized memory:
27# $ printf "IIIIIII\n" > in
28# $ for i in $(seq 10); do LC_ALL=tr_TR.utf8 src/grep -i . in|wc -c; done
29# 760
30# 754
31# 585
32# 298
33# 273
34# 458
35# 660
36# 552
37# 936
38# 678
39
40fail=0
41
42printf "IIIIIII\n" > in || framework_failure_
43LC_ALL=tr_TR.utf8 grep -i .... in > out || fail=1
44compare out in || fail=1
45
46# Also exercise the case in which the original string and the lower-case
47# buffer have precisely the same length (22 bytes here), yet internal
48# offsets do differ. Lengths are the same because while some bytes shrink
49# when converted to lower case, others grow, and here they balance out.
50i='I\304\260'
51printf "$i$i$i$i$i$i$i\n" > in || framework_failure_
52LC_ALL=tr_TR.utf8 grep -i .... in > out || fail=1
53compare out in || fail=1
54
55Exit $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