[windows] skip 'skipping gpg tests on Windows'
[!exec:gpg] skip 'gpg not found in $PATH'

mkhomedir
mkgpgconfig

# test that chezmoi add --encrypt encrypts
cp golden/.encrypted $HOME
chezmoi add --encrypt $HOME${/}.encrypted
exists $CHEZMOISOURCEDIR/encrypted_dot_encrypted.asc
grep '-----BEGIN PGP MESSAGE-----' $CHEZMOISOURCEDIR/encrypted_dot_encrypted.asc

# test that chezmoi apply decrypts
rm $HOME/.encrypted
chezmoi apply --force
cmp golden/.encrypted $HOME/.encrypted

# test that chezmoi edit --apply transparently decrypts and re-encrypts
chezmoi edit --apply --force $HOME${/}.encrypted
grep '# edited' $HOME/.encrypted

-- golden/.encrypted --
# contents of .encrypted
