summaryrefslogtreecommitdiffstats
path: root/pkg/commands/git_commands/commit_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/commands/git_commands/commit_test.go')
-rw-r--r--pkg/commands/git_commands/commit_test.go38
1 files changed, 21 insertions, 17 deletions
diff --git a/pkg/commands/git_commands/commit_test.go b/pkg/commands/git_commands/commit_test.go
index ac129098d..713c9fffa 100644
--- a/pkg/commands/git_commands/commit_test.go
+++ b/pkg/commands/git_commands/commit_test.go
@@ -177,30 +177,34 @@ func TestCommitCreateFixupCommit(t *testing.T) {
func TestCommitShowCmdObj(t *testing.T) {
type scenario struct {
- testName string
- filterPath string
- contextSize int
- expected string
+ testName string
+ filterPath string
+ contextSize int
+ ignoreWhitespace bool
+ expected string
}
scenarios := []scenario{
{
- testName: "Default case without filter path",
- filterPath: "",
- contextSize: 3,
- expected: "git show --submodule --color=always --unified=3 --no-renames --stat -p 1234567890",
+ testName: "Default case without filter path",
+ filterPath: "",
+ contextSize: 3,
+ ignoreWhitespace: false,
+ expected: "git show --submodule --color=always --unified=3 --no-renames --stat -p 1234567890",
},
{
- testName: "Default case with filter path",
- filterPath: "file.txt",
- contextSize: 3,
- expected: `git show --submodule --color=always --unified=3 --no-renames --stat -p 1234567890 -- "file.txt"`,
+ testName: "Default case with filter path",
+ filterPath: "file.txt",
+ contextSize: 3,
+ ignoreWhitespace: true,
+ expected: `git show --submodule --color=always --unified=3 --no-renames --stat -p 1234567890 --ignore-all-space -- "file.txt"`,
},
{
- testName: "Show diff with custom context size",
- filterPath: "",
- contextSize: 77,
- expected: "git show --submodule --color=always --unified=77 --no-renames --stat -p 1234567890",
+ testName: "Show diff with custom context size",
+ filterPath: "",
+ contextSize: 77,
+ ignoreWhitespace: false,
+ expected: "git show --submodule --color=always --unified=77 --no-renames --stat -p 1234567890",
},
}
@@ -212,7 +216,7 @@ func TestCommitShowCmdObj(t *testing.T) {
instance := buildCommitCommands(commonDeps{userConfig: userConfig})
- cmdStr := instance.ShowCmdObj("1234567890", s.filterPath).ToString()
+ cmdStr := instance.ShowCmdObj("1234567890", s.filterPath, s.ignoreWhitespace).ToString()
assert.Equal(t, s.expected, cmdStr)
})
}