Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/usr.bin/grep tests/grep: test word search with UTF-8 l...



details:   https://anonhg.NetBSD.org/src/rev/4c601af1e5db
branches:  trunk
changeset: 1023254:4c601af1e5db
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Aug 30 22:17:32 2021 +0000

description:
tests/grep: test word search with UTF-8 locale

diffstat:

 tests/usr.bin/grep/t_grep.sh |  23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diffs (44 lines):

diff -r 4ea5953c3a14 -r 4c601af1e5db tests/usr.bin/grep/t_grep.sh
--- a/tests/usr.bin/grep/t_grep.sh      Mon Aug 30 21:35:23 2021 +0000
+++ b/tests/usr.bin/grep/t_grep.sh      Mon Aug 30 22:17:32 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_grep.sh,v 1.3 2017/01/14 20:43:52 christos Exp $
+# $NetBSD: t_grep.sh,v 1.4 2021/08/30 22:17:32 rillig Exp $
 #
 # Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -89,6 +89,26 @@
            grep -w separated $(atf_get_srcdir)/d_input
 }
 
+atf_test_case word_locale
+word_locale_head()
+{
+       atf_set "descr" "Checks word search with locale"
+}
+word_locale_body()
+{
+       echo "array[]" > "input"
+
+       # In the default locale, word search works.
+       atf_check -o file:"input" \
+           env LC_ALL=C grep "array" "input"
+       atf_check -o file:"input" \
+           env LC_ALL=C grep -w "array" "input"
+
+       # XXX: In an UTF-8 locale, '[' seems to be a word character.
+       atf_check -s exit:1 -o empty \
+           env LC_ALL="C.UTF-8" grep -w "array" "input"
+}
+
 atf_test_case begin_end
 begin_end_head()
 {
@@ -234,6 +254,7 @@
        atf_add_test_case recurse
        atf_add_test_case recurse_symlink
        atf_add_test_case word_regexps
+       atf_add_test_case word_locale
        atf_add_test_case begin_end
        atf_add_test_case ignore_case
        atf_add_test_case invert



Home | Main Index | Thread Index | Old Index