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
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
Improve integration test infrastructure
  • Loading branch information
twpayne committed May 12, 2020
commit fb3c5893db8e2ef704012e229fee9cb296563770
7 changes: 6 additions & 1 deletion main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ func TestChezmoi(t *testing.T) {
return false, fmt.Errorf("unknown condition: %s", cond)
}
},
Setup: setup,
Setup: setup,
UpdateScripts: os.Getenv("CHEZMOIUPDATESCRIPTS") != "",
})
}

Expand Down Expand Up @@ -69,6 +70,7 @@ func chHome(ts *testscript.TestScript, neg bool, args []string) {
}
ts.Check(os.MkdirAll(homeDir, 0o777))
ts.Setenv("HOME", homeDir)
ts.Setenv("HOMESLASH", filepath.ToSlash(homeDir))
if runtime.GOOS == "windows" {
ts.Setenv("USERPROFILE", homeDir)
}
Expand Down Expand Up @@ -102,18 +104,21 @@ func setup(env *testscript.Env) error {
)

env.Setenv("HOME", homeDir)
env.Setenv("HOMESLASH", filepath.ToSlash(homeDir))
env.Setenv("PATH", prependDirToPath(binDir, env.Getenv("PATH")))
env.Setenv("CHEZMOICONFIGDIR", chezmoiConfigDir)
env.Setenv("CHEZMOISOURCEDIR", chezmoiSourceDir)
switch runtime.GOOS {
case "windows":
env.Setenv("EDITOR", filepath.Join(binDir, "editor.cmd"))
env.Setenv("USERPROFILE", homeDir)
env.Setenv("WORKSLASH", filepath.ToSlash(env.WorkDir))
// There is not currently a convenient way to override the shell on
// Windows.
default:
env.Setenv("EDITOR", filepath.Join(binDir, "editor"))
env.Setenv("SHELL", filepath.Join(binDir, "shell"))
env.Setenv("WORKSLASH", env.WorkDir)
}

// Fix permissions on the source directory, if it exists.
Expand Down