mkhomedir golden
mksourcedir

# test that chezmoi cat prints an empty file
chezmoi cat $HOME${/}.empty
cmp stdout golden/.empty

# test that chezmoi cat prints a file
chezmoi cat $HOME${/}.file
cmp stdout golden/.file

# test that chezmoi cat prints a symlink
chezmoi cat $HOME${/}.symlink
stdout '\.dir/subdir/file'

# test that chezmoi cat prints a template
chezmoi cat $HOME${/}.template
cmp stdout golden/.template

# test that chezmoi cat does not print directories
! chezmoi cat $HOME${/}.dir
stderr 'not a file, script, or symlink'

# test that chezmoi cat does not print files outside the destination directory
! chezmoi cat ${/}etc${/}passwd
stderr 'not in destination directory'

# test that chezmoi cat uses relative paths
mkdir $HOME/.dir
cd $HOME/.dir
chezmoi cat file
cmp stdout $WORK/golden/.dir/file
