# test that chezmoi add --autotemplate on a file with a replacement creates a template in the source directory
chezmoi add --autotemplate $HOME${/}.template
cmp $CHEZMOISOURCEDIR/dot_template.tmpl golden/dot_template.tmpl

# test that chezmoi add --autotemplate on a symlink with a replacement creates a template in the source directory
symlink $HOME/.symlink -> .target-value
chezmoi add --autotemplate $HOME${/}.symlink
cmp $CHEZMOISOURCEDIR/symlink_dot_symlink.tmpl golden/symlink_dot_symlink.tmpl

# test that chezmoi add --autotemplate does not create a template if no replacements occurred
chezmoi add --autotemplate $HOME${/}.file
cmp $CHEZMOISOURCEDIR/dot_file golden/dot_file

-- golden/dot_file --
# contents of .file
-- golden/dot_template.tmpl --
key = {{ .variable }}
-- golden/symlink_dot_symlink.tmpl --
.target-{{ .variable }}
-- home/user/.config/chezmoi/chezmoi.toml --
[data]
    variable = "value"
-- home/user/.file --
# contents of .file
-- home/user/.template --
key = value
