MCPcopy Create free account
hub / github.com/libgit2/git2go / TestTrailers

Function TestTrailers

message_test.go:9–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestTrailers(t *testing.T) {
10 t.Parallel()
11 tests := []struct {
12 input string
13 expected []Trailer
14 }{
15 {
16 "commit with zero trailers\n",
17 []Trailer{},
18 },
19 {
20 "commit with one trailer\n\nCo-authored-by: Alice <alice@example.com>\n",
21 []Trailer{
22 Trailer{Key: "Co-authored-by", Value: "Alice <alice@example.com>"},
23 },
24 },
25 {
26 "commit with two trailers\n\nCo-authored-by: Alice <alice@example.com>\nSigned-off-by: Bob <bob@example.com>\n",
27 []Trailer{
28 Trailer{Key: "Co-authored-by", Value: "Alice <alice@example.com>"},
29 Trailer{Key: "Signed-off-by", Value: "Bob <bob@example.com>"}},
30 },
31 }
32 for _, test := range tests {
33 fmt.Printf("%s", test.input)
34 actual, err := MessageTrailers(test.input)
35 if err != nil {
36 t.Errorf("Trailers returned an unexpected error: %v", err)
37 }
38 if !reflect.DeepEqual(test.expected, actual) {
39 t.Errorf("expecting %#v\ngot %#v", test.expected, actual)
40 }
41 }
42}

Callers

nothing calls this directly

Calls 1

MessageTrailersFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…