Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

sh: Add test for LC_COLLATE-based character ranges in case.

Obtained-from:  FreeBSD 223011
  • Loading branch information...
commit 145340871b73fa4b46a93690ee0248623b16dc65 1 parent e0bacf2
authored December 25, 2011
52  tools/regression/bin/sh/builtins/case6.0
... ...
@@ -0,0 +1,52 @@
  1
+# $FreeBSD: src/tools/regression/bin/sh/builtins/case6.0,v 1.1 2011/06/12 12:27:17 jilles Exp $
  2
+
  3
+unset LC_ALL
  4
+LC_CTYPE=de_DE.ISO8859-1
  5
+export LC_CTYPE
  6
+
  7
+c1=e
  8
+# o umlaut
  9
+c2=$(printf '\366')
  10
+# non-break space
  11
+c3=$(printf '\240')
  12
+c4=$(printf '\240')
  13
+# $c2$c3$c4 form one utf-8 character
  14
+
  15
+ok=0
  16
+case $c1$c2$c3$c4 in
  17
+*) ok=1 ;;
  18
+esac
  19
+if [ $ok = 0 ]; then
  20
+	echo wrong at $LINENO
  21
+	exit 3
  22
+fi
  23
+
  24
+case $c1$c2$c3$c4 in
  25
+$c1$c2$c3$c4) ;;
  26
+*) echo wrong at $LINENO ;;
  27
+esac
  28
+
  29
+case $c1$c2$c3$c4 in
  30
+"$c1$c2$c3$c4") ;;
  31
+*) echo wrong at $LINENO ;;
  32
+esac
  33
+
  34
+case $c1$c2$c3$c4 in
  35
+????) ;;
  36
+*) echo wrong at $LINENO ;;
  37
+esac
  38
+
  39
+case $c1$c2$c3$c4 in
  40
+[!$c2][!b][!c][!d]) ;;
  41
+*) echo wrong at $LINENO ;;
  42
+esac
  43
+
  44
+case $c1$c2$c3$c4 in
  45
+[$c1][$c2][$c3][$c4]) ;;
  46
+*) echo wrong at $LINENO ;;
  47
+esac
  48
+
  49
+case $c1$c2$c3$c4 in
  50
+["$c1"]["$c2"]["$c3"]["$c4"]) ;;
  51
+*) echo wrong at $LINENO ;;
  52
+esac
24  tools/regression/bin/sh/builtins/case7.0
... ...
@@ -0,0 +1,24 @@
  1
+# $FreeBSD: src/tools/regression/bin/sh/builtins/case7.0,v 1.1 2011/06/12 12:55:46 jilles Exp $
  2
+
  3
+# Character ranges in a locale other than the POSIX locale, not specified
  4
+# by POSIX.
  5
+
  6
+unset LC_ALL
  7
+LC_CTYPE=de_DE.ISO8859-1
  8
+export LC_CTYPE
  9
+LC_COLLATE=de_DE.ISO8859-1
  10
+export LC_COLLATE
  11
+
  12
+c1=e
  13
+# o umlaut
  14
+c2=$(printf '\366')
  15
+
  16
+case $c1$c2 in
  17
+[a-z][a-z]) ;;
  18
+*) echo wrong at $LINENO ;;
  19
+esac
  20
+
  21
+case $c1$c2 in
  22
+[a-f][n-p]) ;;
  23
+*) echo wrong at $LINENO ;;
  24
+esac

0 notes on commit 1453408

Please sign in to comment.
Something went wrong with that request. Please try again.