Imported from ../bash-2.05b.tar.gz.
[platform/upstream/bash.git] / tests / glob-test
index 492cfb8..dfb987e 100644 (file)
@@ -7,6 +7,9 @@ expect()
        echo expect "$@"
 }
 
+# First, a test that bash-2.01.1 fails
+${THIS_SH} ./glob1.sub
+
 MYDIR=$PWD     # save where we are
 
 TESTDIR=/tmp/glob-test
@@ -14,7 +17,7 @@ mkdir $TESTDIR
 builtin cd $TESTDIR || { echo $0: cannot cd to $TESTDIR >&2 ; exit 1; }
 rm -rf *
 
-touch a b c d abc abd abe bb bcd ca cb dd de
+touch a b c d abc abd abe bb bcd ca cb dd de Beware
 mkdir bdir
 
 # see if `regular' globbing works right
@@ -81,7 +84,7 @@ expect '<a-b> <aXb>'
 recho a[X-]b
 
 touch .x .y
-expect '<d> <dd> <de>'
+expect '<Beware> <d> <dd> <de>'
 recho [^a-c]*
 
 # Make sure that filenames with embedded globbing characters are handled
@@ -288,6 +291,16 @@ case '-' in
 []-])  echo ok 35 ;;
 esac
 
+# a backslash should just escape the next character in this context
+case p in
+[a-\z])        echo ok 36 ;;
+esac
+
+# this was a bug in all versions up to bash-2.04-release
+case "/tmp" in
+[/\\]*) echo ok 37 ;;
+esac
+
 # none of these should output anything
 
 case abc in
@@ -322,6 +335,14 @@ case '[' in
 [abc)  echo bad 8;;
 esac
 
+# let's start testing the case-insensitive globbing code
+recho b*
+
+shopt -s nocaseglob
+recho b*
+
+recho [b]*
+shopt -u nocaseglob
 
 # make sure set -f works right
 set -f
@@ -348,11 +369,10 @@ GLOBIGNORE=
 expect '<man/man1/bash.1>'
 recho */man*/bash.*
 
-builtin cd /
-rm -rf $TESTDIR
-
 # this is for the benefit of pure coverage, so it writes the pcv file
-# in the right place
+# in the right place, and for gprof
 builtin cd $MYDIR
 
+rm -rf $TESTDIR
+
 exit 0