3 # Copyright (C) 2011 Red Hat Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 # Test guestfish tilde expansion.
20 # RHBZ#617440 guestfish: fails to tilde expand '~' when the $HOME env is unset
21 # RHBZ#511372 guestfish doesn't understand '~' in filenames
22 # and multiple other fixes to tilde handling.
26 # Don't rely on $HOME being set when this script is called.
30 if [ `echo 'echo ~' | ../fish/guestfish` != "$HOME" ]; then
31 echo "$0: failed: did not expand ~ correctly"
35 if [ `echo 'echo ~/foo' | ../fish/guestfish` != "$HOME/foo" ]; then
36 echo "$0: failed: did not expand ~/foo correctly"
40 # We can be reasonably sure that the root user will always exist and
41 # should have a home directory.
44 if [ `echo 'echo ~root' | ../fish/guestfish` != "$root" ]; then
45 echo "$0: failed: did not expand ~root correctly"
49 if [ `echo 'echo ~root/foo' | ../fish/guestfish` != "$root/foo" ]; then
50 echo "$0: failed: did not expand ~root/foo correctly"
58 if [ `echo 'echo ~' | ../fish/guestfish` != "$home" ]; then
59 echo "$0: failed: did not expand ~ correctly when \$HOME unset"
63 if [ `echo 'echo ~/foo' | ../fish/guestfish` != "$home/foo" ]; then
64 echo "$0: failed: did not expand ~/foo correctly when \$HOME unset"
68 # Setting $HOME to pwd above causes guestfish to create a history