Imported from ../bash-2.01.tar.gz.
[platform/upstream/bash.git] / tests / tilde-tests
index f0acd55..f5f5309 100644 (file)
@@ -1,3 +1,9 @@
+# this is needed because posix mode restricts tilde expansion to assignment
+# statements preceding a command, instead of the default of expanding all
+# assignment statements on the line (e.g., after `export').  Without this,
+# the next-to-last test fails
+set +o posix
+
 HOME=/usr/xyz
 SHELL=~/bash
 echo ~ch\et
@@ -33,7 +39,28 @@ echo "$PPATH"
 # yes tilde expansion
 export PPATH=$XPATH:~/bin
 echo "$PPATH"
+declare -x PPATH=$XPATH:~/bin
+echo "$PPATH"
 
 # no tilde expansion
 export PPATH="$XPATH:~/bin"
 echo "$PPATH"
+declare -x PPATH="$XPATH:~/bin"
+echo "$PPATH"
+
+# more tests of tilde expansion when executing case commands
+case ~ in
+$HOME) echo ok 1;;
+*) echo bad 1 ;;
+esac
+
+case ~ in
+~)     echo ok 2 ;;
+\~)    echo bad 2a ;;
+*)     echo bad 2b ;;
+esac
+
+case $unset in
+"")    echo ok 3 ;;
+*)     echo bad 3 ;;
+esac