Module Name: src Committed By: rillig Date: Mon Aug 30 22:17:32 UTC 2021
Modified Files: src/tests/usr.bin/grep: t_grep.sh Log Message: tests/grep: test word search with UTF-8 locale To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/grep/t_grep.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/grep/t_grep.sh diff -u src/tests/usr.bin/grep/t_grep.sh:1.3 src/tests/usr.bin/grep/t_grep.sh:1.4 --- src/tests/usr.bin/grep/t_grep.sh:1.3 Sat Jan 14 20:43:52 2017 +++ src/tests/usr.bin/grep/t_grep.sh Mon Aug 30 22:17:32 2021 @@ -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 @@ word_regexps_body() 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_init_test_cases() 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