MCPcopy Create free account
hub / github.com/ejoffe/spr / TestParseLocalCommitStack

Function TestParseLocalCommitStack

git/commit_test.go:10–138  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func 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: `
21commit d89e0e460ed817c81641f32b1a506b60164b4403 (HEAD -> master)
22Author: Han Solo
23Date: 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: `
42commit d89e0e460ed817c81641f32b1a506b60164b4403 (HEAD -> master)
43Author: Han Solo
44Date: 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: `
65commit d89e0e460ed817c81641f32b1a506b60164b4403 (HEAD -> master)
66Author: Han Solo
67Date: Wed May 21 19:53:12 1980 -0700

Callers

nothing calls this directly

Calls 1

parseLocalCommitStackFunction · 0.85

Tested by

no test coverage detected