(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestParseLocalCommitStack(t *testing.T) { |
| 11 | var buffer bytes.Buffer |
| 12 | tests := []struct { |
| 13 | name string |
| 14 | inputCommitLog string |
| 15 | expectedCommits []Commit |
| 16 | expectedValid bool |
| 17 | }{ |
| 18 | { |
| 19 | name: "SingleValidCommitNoBody", |
| 20 | inputCommitLog: ` |
| 21 | commit d89e0e460ed817c81641f32b1a506b60164b4403 (HEAD -> master) |
| 22 | Author: Han Solo |
| 23 | Date: Wed May 21 19:53:12 1980 -0700 |
| 24 | |
| 25 | Supergalactic speed |
| 26 | |
| 27 | commit-id:053f6d16 |
| 28 | `, |
| 29 | expectedCommits: []Commit{ |
| 30 | { |
| 31 | CommitHash: "d89e0e460ed817c81641f32b1a506b60164b4403", |
| 32 | CommitID: "053f6d16", |
| 33 | Subject: "Supergalactic speed", |
| 34 | Body: "", |
| 35 | }, |
| 36 | }, |
| 37 | expectedValid: true, |
| 38 | }, |
| 39 | { |
| 40 | name: "SingleValidCommitWithBody", |
| 41 | inputCommitLog: ` |
| 42 | commit d89e0e460ed817c81641f32b1a506b60164b4403 (HEAD -> master) |
| 43 | Author: Han Solo |
| 44 | Date: Wed May 21 19:53:12 1980 -0700 |
| 45 | |
| 46 | Supergalactic speed |
| 47 | |
| 48 | Super universe body. |
| 49 | |
| 50 | commit-id:053f6d16 |
| 51 | `, |
| 52 | expectedCommits: []Commit{ |
| 53 | { |
| 54 | CommitHash: "d89e0e460ed817c81641f32b1a506b60164b4403", |
| 55 | CommitID: "053f6d16", |
| 56 | Subject: "Supergalactic speed", |
| 57 | Body: "Super universe body.", |
| 58 | }, |
| 59 | }, |
| 60 | expectedValid: true, |
| 61 | }, |
| 62 | { |
| 63 | name: "TwoValidCommitsNoBody", |
| 64 | inputCommitLog: ` |
| 65 | commit d89e0e460ed817c81641f32b1a506b60164b4403 (HEAD -> master) |
| 66 | Author: Han Solo |
| 67 | Date: Wed May 21 19:53:12 1980 -0700 |
nothing calls this directly
no test coverage detected