1 # $FreeBSD: src/tools/regression/bin/sh/builtins/locale1.0,v 1.1 2010/05/05 21:48:40 jilles Exp $
2 # Note: this test depends on strerror() using locale.
7 if ! eval "[ $1 ]"; then
8 echo "Failed: $1 at $2"
13 unset LANG LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY LC_NUMERIC LC_TIME LC_MESSAGES
15 msgeng="No such file or directory"
16 msgdut="Bestand of map niet gevonden"
18 # Verify C locale error message.
19 case $(command . /var/empty/foo 2>&1) in
23 check '$ok -eq 1' $LINENO
25 # Various locale variables that should not affect the message.
26 case $(LC_ALL=C command . /var/empty/foo 2>&1) in
30 check '$ok -eq 1' $LINENO
32 case $(LC_ALL=C LANG=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in
36 check '$ok -eq 1' $LINENO
38 case $(LC_ALL=C LC_MESSAGES=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in
42 check '$ok -eq 1' $LINENO
44 case $(LC_CTYPE=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in
48 check '$ok -eq 1' $LINENO
50 # Verify Dutch message.
51 case $(export LANG=nl_NL.ISO8859-1; command . /var/empty/foo 2>&1) in
55 check '$ok -eq 1' $LINENO
57 case $(export LC_MESSAGES=nl_NL.ISO8859-1; command . /var/empty/foo 2>&1) in
61 check '$ok -eq 1' $LINENO
63 case $(export LC_ALL=nl_NL.ISO8859-1; command . /var/empty/foo 2>&1) in
67 check '$ok -eq 1' $LINENO
69 case $(LANG=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in
73 check '$ok -eq 1' $LINENO
75 case $(LC_MESSAGES=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in
79 check '$ok -eq 1' $LINENO
81 case $(LC_ALL=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in
85 check '$ok -eq 1' $LINENO
87 # Verify that command assignments do not set the locale persistently.
88 case $(command . /var/empty/foo 2>&1) in
92 check '$ok -eq 1' $LINENO
94 case $(LANG=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1; command . /var/empty/foo 2>&1) in
95 *"$msgdut"*"$msgeng"*) ok=1 ;;
98 check '$ok -eq 1' $LINENO
100 case $(LC_MESSAGES=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1; command . /var/empty/foo 2>&1) in
101 *"$msgdut"*"$msgeng"*) ok=1 ;;
104 check '$ok -eq 1' $LINENO
106 case $(LC_ALL=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1; command . /var/empty/foo 2>&1) in
107 *"$msgdut"*"$msgeng"*) ok=1 ;;
110 check '$ok -eq 1' $LINENO
112 # Check special builtin; add colon invocation to avoid depending on certain fix.
113 case $(LC_ALL=nl_NL.ISO8859-1 . /var/empty/foo 2>&1; :) in
117 check '$ok -eq 1' $LINENO
119 # Assignments on special builtins are exported to that builtin; the export
121 case $(LC_ALL=nl_NL.ISO8859-1 . /dev/null; . /var/empty/foo 2>&1) in
125 check '$ok -eq 1' $LINENO
127 case $(export LC_ALL; LC_ALL=nl_NL.ISO8859-1 . /dev/null; . /var/empty/foo 2>&1) in
131 check '$ok -eq 1' $LINENO
133 exit $((failures > 0))