mkhomedir
mksourcedir

# test that chezmoi remove file removes a file
chezmoi apply --force
exists $HOME/.file
chezmoi remove --force $HOME${/}.file
! exists $HOME/.file
chezmoi state get --bucket=entryState --key=$WORK/home/user/.file
! stdout .

# test that chezmoi remove dir removes a directory
exists $HOME/.dir
chezmoi remove --force $HOME${/}.dir
! exists $HOME/.dir

# test that if any chezmoi remove stops on any error
exists $HOME/.executable
! chezmoi remove --force $HOME${/}.newfile $HOME${/}.executable
stderr 'not in source state'
exists $HOME/.executable

chhome home2/user

# test that chezmoi apply removes a file and a directory
exists $HOME/.file
exists $HOME/.dir
chezmoi apply
! exists $HOME/.file
! exists $HOME/.dir

-- home2/user/.dir/.keep --
-- home2/user/.file --
# contents of .file
-- home2/user/.local/share/chezmoi/remove_dot_file --
-- home2/user/.local/share/chezmoi/remove_dot_dir --
