|
|
|
@ -129,7 +129,7 @@ func TestIncludesAndExcludes(t *testing.T) {
|
|
|
|
|
test.WriteConfig(t, configPath, cfg)
|
|
|
|
|
out, err := cmd(t, "-c", "--config-file", configPath, "--tree-root", tempDir)
|
|
|
|
|
as.NoError(err)
|
|
|
|
|
as.Contains(string(out), fmt.Sprintf("%d files changed", 30))
|
|
|
|
|
as.Contains(string(out), fmt.Sprintf("%d files changed", 29))
|
|
|
|
|
|
|
|
|
|
// globally exclude nix files
|
|
|
|
|
cfg.Global.Excludes = []string{"*.nix"}
|
|
|
|
@ -137,7 +137,7 @@ func TestIncludesAndExcludes(t *testing.T) {
|
|
|
|
|
test.WriteConfig(t, configPath, cfg)
|
|
|
|
|
out, err = cmd(t, "-c", "--config-file", configPath, "--tree-root", tempDir)
|
|
|
|
|
as.NoError(err)
|
|
|
|
|
as.Contains(string(out), fmt.Sprintf("%d files changed", 29))
|
|
|
|
|
as.Contains(string(out), fmt.Sprintf("%d files changed", 28))
|
|
|
|
|
|
|
|
|
|
// add haskell files to the global exclude
|
|
|
|
|
cfg.Global.Excludes = []string{"*.nix", "*.hs"}
|
|
|
|
@ -145,7 +145,7 @@ func TestIncludesAndExcludes(t *testing.T) {
|
|
|
|
|
test.WriteConfig(t, configPath, cfg)
|
|
|
|
|
out, err = cmd(t, "-c", "--config-file", configPath, "--tree-root", tempDir)
|
|
|
|
|
as.NoError(err)
|
|
|
|
|
as.Contains(string(out), fmt.Sprintf("%d files changed", 23))
|
|
|
|
|
as.Contains(string(out), fmt.Sprintf("%d files changed", 22))
|
|
|
|
|
|
|
|
|
|
echo := cfg.Formatters["echo"]
|
|
|
|
|
|
|
|
|
@ -155,7 +155,7 @@ func TestIncludesAndExcludes(t *testing.T) {
|
|
|
|
|
test.WriteConfig(t, configPath, cfg)
|
|
|
|
|
out, err = cmd(t, "-c", "--config-file", configPath, "--tree-root", tempDir)
|
|
|
|
|
as.NoError(err)
|
|
|
|
|
as.Contains(string(out), fmt.Sprintf("%d files changed", 21))
|
|
|
|
|
as.Contains(string(out), fmt.Sprintf("%d files changed", 20))
|
|
|
|
|
|
|
|
|
|
// remove go files from the echo formatter
|
|
|
|
|
echo.Excludes = []string{"*.py", "*.go"}
|
|
|
|
@ -163,7 +163,7 @@ func TestIncludesAndExcludes(t *testing.T) {
|
|
|
|
|
test.WriteConfig(t, configPath, cfg)
|
|
|
|
|
out, err = cmd(t, "-c", "--config-file", configPath, "--tree-root", tempDir)
|
|
|
|
|
as.NoError(err)
|
|
|
|
|
as.Contains(string(out), fmt.Sprintf("%d files changed", 20))
|
|
|
|
|
as.Contains(string(out), fmt.Sprintf("%d files changed", 19))
|
|
|
|
|
|
|
|
|
|
// adjust the includes for echo to only include elm files
|
|
|
|
|
echo.Includes = []string{"*.elm"}
|
|
|
|
@ -201,7 +201,7 @@ func TestCache(t *testing.T) {
|
|
|
|
|
test.WriteConfig(t, configPath, cfg)
|
|
|
|
|
out, err := cmd(t, "--config-file", configPath, "--tree-root", tempDir)
|
|
|
|
|
as.NoError(err)
|
|
|
|
|
as.Contains(string(out), fmt.Sprintf("%d files changed", 30))
|
|
|
|
|
as.Contains(string(out), fmt.Sprintf("%d files changed", 29))
|
|
|
|
|
|
|
|
|
|
out, err = cmd(t, "--config-file", configPath, "--tree-root", tempDir)
|
|
|
|
|
as.NoError(err)
|
|
|
|
@ -210,16 +210,7 @@ func TestCache(t *testing.T) {
|
|
|
|
|
// clear cache
|
|
|
|
|
out, err = cmd(t, "--config-file", configPath, "--tree-root", tempDir, "-c")
|
|
|
|
|
as.NoError(err)
|
|
|
|
|
as.Contains(string(out), fmt.Sprintf("%d files changed", 30))
|
|
|
|
|
|
|
|
|
|
out, err = cmd(t, "--config-file", configPath, "--tree-root", tempDir)
|
|
|
|
|
as.NoError(err)
|
|
|
|
|
as.Contains(string(out), "0 files changed")
|
|
|
|
|
|
|
|
|
|
// clear cache
|
|
|
|
|
out, err = cmd(t, "--config-file", configPath, "--tree-root", tempDir, "-c")
|
|
|
|
|
as.NoError(err)
|
|
|
|
|
as.Contains(string(out), fmt.Sprintf("%d files changed", 30))
|
|
|
|
|
as.Contains(string(out), fmt.Sprintf("%d files changed", 29))
|
|
|
|
|
|
|
|
|
|
out, err = cmd(t, "--config-file", configPath, "--tree-root", tempDir)
|
|
|
|
|
as.NoError(err)
|
|
|
|
@ -228,7 +219,7 @@ func TestCache(t *testing.T) {
|
|
|
|
|
// no cache
|
|
|
|
|
out, err = cmd(t, "--config-file", configPath, "--tree-root", tempDir, "--no-cache")
|
|
|
|
|
as.NoError(err)
|
|
|
|
|
as.Contains(string(out), fmt.Sprintf("%d files changed", 30))
|
|
|
|
|
as.Contains(string(out), fmt.Sprintf("%d files changed", 29))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestChangeWorkingDirectory(t *testing.T) {
|
|
|
|
@ -262,7 +253,7 @@ func TestChangeWorkingDirectory(t *testing.T) {
|
|
|
|
|
// this should fail if the working directory hasn't been changed first
|
|
|
|
|
out, err := cmd(t, "-C", tempDir)
|
|
|
|
|
as.NoError(err)
|
|
|
|
|
as.Contains(string(out), fmt.Sprintf("%d files changed", 30))
|
|
|
|
|
as.Contains(string(out), fmt.Sprintf("%d files changed", 29))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestFailOnChange(t *testing.T) {
|
|
|
|
@ -439,16 +430,16 @@ func TestGitWorktree(t *testing.T) {
|
|
|
|
|
// add everything to the worktree
|
|
|
|
|
as.NoError(wt.AddGlob("."))
|
|
|
|
|
as.NoError(err)
|
|
|
|
|
run(30)
|
|
|
|
|
run(29)
|
|
|
|
|
|
|
|
|
|
// remove python directory
|
|
|
|
|
as.NoError(wt.RemoveGlob("python/*"))
|
|
|
|
|
run(27)
|
|
|
|
|
run(26)
|
|
|
|
|
|
|
|
|
|
// walk with filesystem instead of git
|
|
|
|
|
out, err := cmd(t, "-c", "--config-file", configPath, "--tree-root", tempDir, "--walk", "filesystem")
|
|
|
|
|
as.NoError(err)
|
|
|
|
|
as.Contains(string(out), fmt.Sprintf("%d files changed", 57))
|
|
|
|
|
as.Contains(string(out), fmt.Sprintf("%d files changed", 55))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestOrderingFormatters(t *testing.T) {
|
|
|
|
@ -537,7 +528,7 @@ func TestPathsArg(t *testing.T) {
|
|
|
|
|
// without any path args
|
|
|
|
|
out, err := cmd(t, "-C", tempDir)
|
|
|
|
|
as.NoError(err)
|
|
|
|
|
as.Contains(string(out), fmt.Sprintf("%d files changed", 30))
|
|
|
|
|
as.Contains(string(out), fmt.Sprintf("%d files changed", 29))
|
|
|
|
|
|
|
|
|
|
// specify some explicit paths
|
|
|
|
|
out, err = cmd(t, "-C", tempDir, "-c", "elm/elm.json", "haskell/Nested/Foo.hs")
|
|
|
|
|