MCPcopy
hub / github.com/jesseduffield/lazygit / TestCommitShowCmdObj

Function TestCommitShowCmdObj

pkg/commands/git_commands/commit_test.go:251–348  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

249}
250
251func TestCommitShowCmdObj(t *testing.T) {
252 type scenario struct {
253 testName string
254 filterPaths []string
255 contextSize uint64
256 similarityThreshold int
257 ignoreWhitespace bool
258 pagerConfig *config.PagingConfig
259 expected []string
260 }
261
262 scenarios := []scenario{
263 {
264 testName: "Default case without filter path",
265 filterPaths: []string{},
266 contextSize: 3,
267 similarityThreshold: 50,
268 ignoreWhitespace: false,
269 pagerConfig: nil,
270 expected: []string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "show", "--no-ext-diff", "--submodule", "--color=always", "--unified=3", "--stat", "--decorate", "-p", "1234567890", "--find-renames=50%", "--"},
271 },
272 {
273 testName: "Default case with filter path",
274 filterPaths: []string{"file.txt"},
275 contextSize: 3,
276 similarityThreshold: 50,
277 ignoreWhitespace: false,
278 pagerConfig: nil,
279 expected: []string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "show", "--no-ext-diff", "--submodule", "--color=always", "--unified=3", "--stat", "--decorate", "-p", "1234567890", "--find-renames=50%", "--", "file.txt"},
280 },
281 {
282 testName: "Show diff with custom context size",
283 filterPaths: []string{},
284 contextSize: 77,
285 similarityThreshold: 50,
286 ignoreWhitespace: false,
287 pagerConfig: nil,
288 expected: []string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "show", "--no-ext-diff", "--submodule", "--color=always", "--unified=77", "--stat", "--decorate", "-p", "1234567890", "--find-renames=50%", "--"},
289 },
290 {
291 testName: "Show diff with custom similarity threshold",
292 filterPaths: []string{},
293 contextSize: 3,
294 similarityThreshold: 33,
295 ignoreWhitespace: false,
296 pagerConfig: nil,
297 expected: []string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "show", "--no-ext-diff", "--submodule", "--color=always", "--unified=3", "--stat", "--decorate", "-p", "1234567890", "--find-renames=33%", "--"},
298 },
299 {
300 testName: "Show diff, ignoring whitespace",
301 filterPaths: []string{},
302 contextSize: 77,
303 similarityThreshold: 50,
304 ignoreWhitespace: true,
305 pagerConfig: nil,
306 expected: []string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "show", "--no-ext-diff", "--submodule", "--color=always", "--unified=77", "--stat", "--decorate", "-p", "1234567890", "--ignore-all-space", "--find-renames=50%", "--"},
307 },
308 {

Callers

nothing calls this directly

Calls 7

GetDefaultConfigFunction · 0.92
NewFakeRunnerFunction · 0.92
buildCommitCommandsFunction · 0.85
ExpectGitArgsMethod · 0.80
ShowCmdObjMethod · 0.80
CheckForMissingCallsMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected