Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more integration tests #747

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use OS path separator in source-path output
  • Loading branch information
twpayne committed May 12, 2020
commit 5aa228a9d9a96089771817eeedd6fb0a4da91c7d
2 changes: 1 addition & 1 deletion cmd/sourcepath.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (c *Config) runSourcePathCmd(cmd *cobra.Command, args []string) error {
return err
}
for _, entry := range entries {
if _, err := fmt.Println(filepath.Join(ts.SourceDir, entry.SourceName())); err != nil {
if _, err := fmt.Println(filepath.FromSlash(filepath.Join(ts.SourceDir, entry.SourceName()))); err != nil {
return err
}
}
Expand Down
15 changes: 12 additions & 3 deletions testdata/scripts/sourcepath.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
chezmoi source-path
stdout ${CHEZMOISOURCEDIR@R}
cmpenv stdout golden/source-path

chezmoi source-path $HOME${/}.bashrc
env WANT=${CHEZMOISOURCEDIR}${/}dot_bashrc
stdout ${WANT@R}
cmpenv stdout golden/source-path-bashrc

! chezmoi source-path $HOME${/}.inputrc
stdout 'file does not exist'

! chezmoi source-path $WORK${/}etc${/}passwd
stdout 'outside target directory'

-- golden/source-path --
$HOME${/}.local${/}share${/}chezmoi
-- golden/source-path-bashrc --
$HOME${/}.local${/}share${/}chezmoi${/}dot_bashrc
-- home/user/.local/share/chezmoi/dot_bashrc --
# contents of .bashrc