mkhomedir golden
mkhomedir
mksourcedir

# test that chezmoi verify succeeds
exec chezmoi verify

# test that chezmoi verify fails when a file is added to the source state
cp golden/dot_newfile $CHEZMOISOURCEDIR/dot_newfile
! exec chezmoi verify
exec chezmoi forget --force $HOME${/}.newfile
exec chezmoi verify

# test that chezmoi verify fails when a file is edited
edit $HOME/.file
! exec chezmoi verify
exec chezmoi apply --force $HOME${/}.file
exec chezmoi verify

# test that chezmoi verify fails when a file is removed from the destination directory
rm $HOME/.file
! exec chezmoi verify
exec chezmoi apply --force $HOME${/}.file
exec chezmoi verify

# test that chezmoi verify fails when a directory is removed from the destination directory
rm $HOME/.dir
! exec chezmoi verify
mkdir $HOME/.dir
exec chezmoi apply --force $HOME${/}.dir
exec chezmoi verify

[windows] stop 'remaining tests use file modes'

# test that chezmoi verify fails when a file's permissions are changed
chmod 777 $HOME/.file
! exec chezmoi verify
exec chezmoi apply --force $HOME${/}.file
exec chezmoi verify

# test that chezmoi verify fails when a directory's permissions are changed
chmod 700 $HOME/.dir
! exec chezmoi verify
exec chezmoi apply --force $HOME${/}.dir
exec chezmoi verify

-- golden/dot_newfile --
# contents of .newfile
