(t *testing.T)
| 495 | } |
| 496 | |
| 497 | func TestClientCommits(t *testing.T) { |
| 498 | tests := []struct { |
| 499 | name string |
| 500 | testData stubbedCommitsCommandData |
| 501 | wantCmdArgs string |
| 502 | wantCommits []*Commit |
| 503 | wantErrorMsg string |
| 504 | }{ |
| 505 | { |
| 506 | name: "single commit no body", |
| 507 | testData: stubbedCommitsCommandData{ |
| 508 | Commits: []stubbedCommit{ |
| 509 | { |
| 510 | Sha: "6a6872b918c601a0e730710ad8473938a7516d30", |
| 511 | Title: "testing testability test", |
| 512 | Body: "", |
| 513 | }, |
| 514 | }, |
| 515 | }, |
| 516 | wantCmdArgs: `path/to/git -c log.ShowSignature=false log --pretty=format:%H%x00%s%x00%b%x00 --cherry SHA1...SHA2`, |
| 517 | wantCommits: []*Commit{{ |
| 518 | Sha: "6a6872b918c601a0e730710ad8473938a7516d30", |
| 519 | Title: "testing testability test", |
| 520 | }}, |
| 521 | }, |
| 522 | { |
| 523 | name: "single commit with body", |
| 524 | testData: stubbedCommitsCommandData{ |
| 525 | Commits: []stubbedCommit{ |
| 526 | { |
| 527 | Sha: "6a6872b918c601a0e730710ad8473938a7516d30", |
| 528 | Title: "testing testability test", |
| 529 | Body: "This is the body", |
| 530 | }, |
| 531 | }, |
| 532 | }, |
| 533 | wantCmdArgs: `path/to/git -c log.ShowSignature=false log --pretty=format:%H%x00%s%x00%b%x00 --cherry SHA1...SHA2`, |
| 534 | wantCommits: []*Commit{{ |
| 535 | Sha: "6a6872b918c601a0e730710ad8473938a7516d30", |
| 536 | Title: "testing testability test", |
| 537 | Body: "This is the body", |
| 538 | }}, |
| 539 | }, |
| 540 | { |
| 541 | name: "multiple commits with bodies", |
| 542 | testData: stubbedCommitsCommandData{ |
| 543 | Commits: []stubbedCommit{ |
| 544 | { |
| 545 | Sha: "6a6872b918c601a0e730710ad8473938a7516d30", |
| 546 | Title: "testing testability test", |
| 547 | Body: "This is the body", |
| 548 | }, |
| 549 | { |
| 550 | Sha: "7a6872b918c601a0e730710ad8473938a7516d31", |
| 551 | Title: "testing testability test 2", |
| 552 | Body: "This is the body 2", |
| 553 | }, |
| 554 | }, |
nothing calls this directly
no test coverage detected