1 # NOTE: this file contains UTF8 characters.
4 proc selectlocale { pattern } {
5 if [ catch { set locale_list [ split [ eval exec locale -a ] "\n" ] } ] {
6 # Failed to figure out which tests are supported.
9 foreach locale $locale_list {
10 if { [string match $pattern $locale] } {
12 set env(LC_ALL) $locale
19 proc select_any_locale { patternlist } {
20 foreach pattern $patternlist {
21 set locale [ selectlocale $pattern ]
22 if { [ string length $locale ] } {
29 # localeoptions contains a list (in order of preference) of the
30 # locales in which we want to perform part of this test. If we can
31 # use any locale matching any of the patterns, we run an extra four
32 # tests. Otherwise, we skip them and issue a warning message.
45 # Do the regular case-fold tests which only need ASCII support.
46 locate_textonly p a "teste\n" "-i teste" "teste\n"
47 locate_textonly p b "testE\n" "-i testE" "testE\n"
48 locate_textonly p c "testE\n" "-i teste" "testE\n"
49 locate_textonly p d "teste\n" "-i testE" "teste\n"
51 set locale [ select_any_locale $localeoptions ]
52 if { [ string length $locale ] } {
53 # We have a UTF-8 locale. Do the extra tests.
54 locate_textonly p 0 "testé\n" "-i testé" "testé\n"
55 locate_textonly p 1 "testÉ\n" "-i testé" "testÉ\n"
56 locate_textonly p 2 "testé\n" "-i testÉ" "testé\n"
57 locate_textonly p 3 "testÉ\n" "-i testÉ" "testÉ\n"
59 warning "Four tests have been skipped because I cannot find a UTF-8 locale configured on your system"