sh: Add test for LC_COLLATE-based character ranges in case.
authorPeter Avalos <pavalos@dragonflybsd.org>
Sun, 25 Dec 2011 17:41:23 +0000 (09:41 -0800)
committerPeter Avalos <pavalos@dragonflybsd.org>
Sun, 25 Dec 2011 17:41:23 +0000 (09:41 -0800)
Obtained-from:  FreeBSD 223011

tools/regression/bin/sh/builtins/case6.0 [new file with mode: 0644]
tools/regression/bin/sh/builtins/case7.0 [new file with mode: 0644]

diff --git a/tools/regression/bin/sh/builtins/case6.0 b/tools/regression/bin/sh/builtins/case6.0
new file mode 100644 (file)
index 0000000..cf3dbe1
--- /dev/null
@@ -0,0 +1,52 @@
+# $FreeBSD: src/tools/regression/bin/sh/builtins/case6.0,v 1.1 2011/06/12 12:27:17 jilles Exp $
+
+unset LC_ALL
+LC_CTYPE=de_DE.ISO8859-1
+export LC_CTYPE
+
+c1=e
+# o umlaut
+c2=$(printf '\366')
+# non-break space
+c3=$(printf '\240')
+c4=$(printf '\240')
+# $c2$c3$c4 form one utf-8 character
+
+ok=0
+case $c1$c2$c3$c4 in
+*) ok=1 ;;
+esac
+if [ $ok = 0 ]; then
+       echo wrong at $LINENO
+       exit 3
+fi
+
+case $c1$c2$c3$c4 in
+$c1$c2$c3$c4) ;;
+*) echo wrong at $LINENO ;;
+esac
+
+case $c1$c2$c3$c4 in
+"$c1$c2$c3$c4") ;;
+*) echo wrong at $LINENO ;;
+esac
+
+case $c1$c2$c3$c4 in
+????) ;;
+*) echo wrong at $LINENO ;;
+esac
+
+case $c1$c2$c3$c4 in
+[!$c2][!b][!c][!d]) ;;
+*) echo wrong at $LINENO ;;
+esac
+
+case $c1$c2$c3$c4 in
+[$c1][$c2][$c3][$c4]) ;;
+*) echo wrong at $LINENO ;;
+esac
+
+case $c1$c2$c3$c4 in
+["$c1"]["$c2"]["$c3"]["$c4"]) ;;
+*) echo wrong at $LINENO ;;
+esac
diff --git a/tools/regression/bin/sh/builtins/case7.0 b/tools/regression/bin/sh/builtins/case7.0
new file mode 100644 (file)
index 0000000..1fa2c4a
--- /dev/null
@@ -0,0 +1,24 @@
+# $FreeBSD: src/tools/regression/bin/sh/builtins/case7.0,v 1.1 2011/06/12 12:55:46 jilles Exp $
+
+# Character ranges in a locale other than the POSIX locale, not specified
+# by POSIX.
+
+unset LC_ALL
+LC_CTYPE=de_DE.ISO8859-1
+export LC_CTYPE
+LC_COLLATE=de_DE.ISO8859-1
+export LC_COLLATE
+
+c1=e
+# o umlaut
+c2=$(printf '\366')
+
+case $c1$c2 in
+[a-z][a-z]) ;;
+*) echo wrong at $LINENO ;;
+esac
+
+case $c1$c2 in
+[a-f][n-p]) ;;
+*) echo wrong at $LINENO ;;
+esac