MCPcopy Create free account
hub / github.com/ChimeraCoder/gitgo / Test_parseObjInitialCommit

Function Test_parseObjInitialCommit

cat-file_test.go:28–53  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26}
27
28func Test_parseObjInitialCommit(t *testing.T) {
29 expected := Commit{
30 _type: "commit",
31 Tree: "9de6c72106b169990a83ce7090c7cad84b6b506b",
32 Parents: nil,
33 Author: "aditya <dev@chimeracoder.net> 1428075900 -0400",
34 Committer: "aditya <dev@chimeracoder.net> 1428075900 -0400",
35 Message: "First commit. Create .gitignore",
36 size: "190",
37 }
38
39 const input = "commit 190\x00" + `tree 9de6c72106b169990a83ce7090c7cad84b6b506b
40author aditya <dev@chimeracoder.net> 1428075900 -0400
41committer aditya <dev@chimeracoder.net> 1428075900 -0400
42
43First commit. Create .gitignore`
44 result, err := parseObj(input)
45 if err != nil {
46 t.Error(err)
47 return
48 }
49
50 if !reflect.DeepEqual(expected, result) {
51 t.Errorf("Expected and result don't match:\n%+v\n%+v", expected, result)
52 }
53}
54
55func Test_parseObj(t *testing.T) {
56 const inputSha = SHA("3ead3116d0378089f5ce61086354aac43e736b01")

Callers

nothing calls this directly

Calls 1

parseObjFunction · 0.85

Tested by

no test coverage detected