# test that .chezmoi.sourceDir can be used with joinPath
[!windows] chezmoi execute-template '{{ joinPath .chezmoi.sourceDir ".file" }}'
[!windows] stdout ${CHEZMOISOURCEDIR@R}/.file

# test that .chezmoi.sourceFile is set
chezmoi cat $HOME${/}.file
stdout dot_file.tmpl

# test that .chezmoi.kernel is set on linux
[linux] chezmoi execute-template '{{ .chezmoi.kernel.ostype }}'
[linux] stdout Linux

chhome home2/user

# test that .chezmoidata.<format> and .chezmoitemplates are available in .chezmoiignore
chezmoi apply
exists $HOME/.file1
! exists $HOME/.file2

chhome home3/user

# test that data execute-template ignores template errors
chezmoi data
stdout ok

# test that chezmoi execute-template ignores template errors
chezmoi execute-template '{{ template "template" . }}'
stdout ok

-- home/user/.local/share/chezmoi/dot_file.tmpl --
{{ .chezmoi.sourceFile }}
-- home2/user/.local/share/chezmoi/.chezmoidata.toml --
filename = ".file2"
-- home2/user/.local/share/chezmoi/.chezmoitemplates/ignore --
{{ .filename }}
-- home2/user/.local/share/chezmoi/.chezmoiignore --
{{ template "ignore" . }}
-- home2/user/.local/share/chezmoi/dot_file1 --
# contents of .file1
-- home2/user/.local/share/chezmoi/dot_file2 --
# contents of .file2
-- home3/user/.local/share/chezmoi/.chezmoi.toml.tmpl --
{{ "invalid template"
-- home3/user/.local/share/chezmoi/.chezmoidata.yaml --
message: ok
-- home3/user/.local/share/chezmoi/.chezmoitemplates/template --
{{ .message }}
-- home3/user/.local/share/chezmoi/.chezmoiexternal.toml --
{{ "invalid template"
-- home3/user/.local/share/chezmoi/.chezmoiignore --
{{ "invalid template"
-- home3/user/.local/share/chezmoi/.chezmoiremove --
{{ "invalid template"
