[!windows] skip 'Windows only'

# test that chezmoi status prints that it will run the script
chezmoi status
cmp stdout golden/status

# test that chezmoi apply runs the script
chezmoi apply --force
stdout ${HOME@R}

# test that the script is recorded in the state
chezmoi state dump
stdout 4716eebb443f263affd831da48c4af62715fab9dc9e6a813f8bf8992aa53c5b4 # sha256sum of script contents

# test that chezmoi status will not print that it will run the script
chezmoi status
! stdout .

# test that chezmoi apply does not run the script a second time
chezmoi apply --force
! stdout ${HOME@R}

# test that reseting the state causes the next chezmoi apply to run the script
chezmoi state reset --force
chezmoi apply --force
stdout ${HOME@R}

-- golden/status --
 R script.cmd
-- home/user/.local/share/chezmoi/run_once_script.cmd --
@echo %cd%
