1 # $FreeBSD: head/bin/sh/tests/builtins/locale1.0 218819 2011-02-18 20:37:09Z jilles $
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
16 msgeng="No such file or directory"
17 msgdut="Bestand of map niet gevonden"
19 # Verify C locale error message.
20 case $(command . /var/empty/foo 2>&1) in
24 check '$ok -eq 1' $LINENO
26 # Various locale variables that should not affect the message.
27 case $(LC_ALL=C command . /var/empty/foo 2>&1) in
31 check '$ok -eq 1' $LINENO
33 case $(LC_ALL=C LANG=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in
37 check '$ok -eq 1' $LINENO
39 case $(LC_ALL=C LC_MESSAGES=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in
43 check '$ok -eq 1' $LINENO
45 case $(LC_CTYPE=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in
49 check '$ok -eq 1' $LINENO
51 # Verify Dutch message.
52 case $(export LANG=nl_NL.ISO8859-1; command . /var/empty/foo 2>&1) in
56 check '$ok -eq 1' $LINENO
58 case $(export LC_MESSAGES=nl_NL.ISO8859-1; command . /var/empty/foo 2>&1) in
62 check '$ok -eq 1' $LINENO
64 case $(export LC_ALL=nl_NL.ISO8859-1; command . /var/empty/foo 2>&1) in
68 check '$ok -eq 1' $LINENO
70 case $(LANG=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in
74 check '$ok -eq 1' $LINENO
76 case $(LC_MESSAGES=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in
80 check '$ok -eq 1' $LINENO
82 case $(LC_ALL=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1) in
86 check '$ok -eq 1' $LINENO
88 # Verify that command assignments do not set the locale persistently.
89 case $(command . /var/empty/foo 2>&1) in
93 check '$ok -eq 1' $LINENO
95 case $(LANG=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1; command . /var/empty/foo 2>&1) in
96 *"$msgdut"*"$msgeng"*) ok=1 ;;
99 check '$ok -eq 1' $LINENO
101 case $(LC_MESSAGES=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1; command . /var/empty/foo 2>&1) in
102 *"$msgdut"*"$msgeng"*) ok=1 ;;
105 check '$ok -eq 1' $LINENO
107 case $(LC_ALL=nl_NL.ISO8859-1 command . /var/empty/foo 2>&1; command . /var/empty/foo 2>&1) in
108 *"$msgdut"*"$msgeng"*) ok=1 ;;
111 check '$ok -eq 1' $LINENO
113 # Check special builtin; add colon invocation to avoid depending on certain fix.
114 case $(LC_ALL=nl_NL.ISO8859-1 . /var/empty/foo 2>&1; :) in
118 check '$ok -eq 1' $LINENO
120 # Assignments on special builtins are exported to that builtin; the export
122 case $(LC_ALL=nl_NL.ISO8859-1 . /dev/null; . /var/empty/foo 2>&1) in
126 check '$ok -eq 1' $LINENO
128 case $(export LC_ALL; LC_ALL=nl_NL.ISO8859-1 . /dev/null; . /var/empty/foo 2>&1) in
132 check '$ok -eq 1' $LINENO
134 exit $((failures > 0))