diff options
Diffstat (limited to 'tests/glob3.sub')
-rw-r--r-- | tests/glob3.sub | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/tests/glob3.sub b/tests/glob3.sub index 378234db..662c65e9 100644 --- a/tests/glob3.sub +++ b/tests/glob3.sub @@ -1,5 +1,24 @@ +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# : ${TMPDIR:=/var/tmp} -cd $TMPDIR + +TESTDIR=${TMPDIR}/glob-test-$$ +mkdir ${TESTDIR} +cd $TESTDIR || { + echo "$TESTDIR: cannot cd" >&2 + exit 1 +} matchfunc() { @@ -25,10 +44,21 @@ matchfunc() *) echo bad 2;; esac + case x in + [[:aeioux:]) echo bad 2.1 ;; + *) echo ok 2.1 ;; + esac + case [x in [[:alpha:]) echo bad 3;; *) echo ok 3;; esac + + # unclosed bracket char class expression just matches against ":alpha" + case a in + [[:alpha]) echo ok 4;; + *) echo bad 4;; + esac } echo invalid bracket expression @@ -44,6 +74,12 @@ matchfunc() { echo == LANG=$LANG == + touch p + # quoted character classes work as if they were unquoted now + echo [[:alpha:]] + echo [[:"alpha":]] + rm -f p + case a] in [[:aleph:]]) echo bad 1;; *) echo ok 1;; @@ -59,9 +95,10 @@ matchfunc() *) echo ok 3;; esac - case a in - [[:"alpha":]]) echo bad 4;; - *) echo ok 4;; + # Posix says quoted character class names work now + case x in + [[:"alpha":]]) echo ok 4;; + *) echo bad 4;; esac case a in @@ -121,3 +158,6 @@ matchfunc export LANG=en_US.UTF-8 matchfunc + +cd $OLDPWD +rm -rf $TESTDIR |