MCPcopy Index your code
hub / github.com/ChimeraCoder/gitgo / Test_parseObj

Function Test_parseObj

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

Source from the content-addressed store, hash-verified

53}
54
55func Test_parseObj(t *testing.T) {
56 const inputSha = SHA("3ead3116d0378089f5ce61086354aac43e736b01")
57
58 expected := Commit{
59 _type: "commit",
60 Tree: "d22fc8a57073fdecae2001d00aff921440d3aabd",
61 Parents: []string{"1d833eb5b6c5369c0cb7a4a3e20ded237490145f"},
62 Author: "aditya <dev@chimeracoder.net> 1428349896 -0400",
63 Committer: "aditya <dev@chimeracoder.net> 1428349896 -0400",
64 Message: "Remove extraneous logging statements\n",
65 size: "243",
66 }
67
68 str, err := CatFile(inputSha)
69 if err != nil {
70 t.Error(err)
71 }
72
73 result, err := parseObj(str)
74 if err != nil {
75 t.Error(err)
76 return
77 }
78
79 if !reflect.DeepEqual(expected, result) {
80 t.Errorf("Expected and result don't match:\n%+v\n%+v", expected, result)
81 }
82}
83
84func Test_ParseTree(t *testing.T) {
85 const inputSha = SHA("1efecd717188441397c07f267cf468fdf04d4796")

Callers

nothing calls this directly

Calls 3

SHATypeAlias · 0.85
CatFileFunction · 0.85
parseObjFunction · 0.85

Tested by

no test coverage detected