| 7 | ) |
| 8 | |
| 9 | func Test_CatFile(t *testing.T) { |
| 10 | const inputSha = SHA("97eed02ebe122df8fdd853c1215d8775f3d9f1a1") |
| 11 | const expected = "commit 190\x00" + `tree 9de6c72106b169990a83ce7090c7cad84b6b506b |
| 12 | author aditya <dev@chimeracoder.net> 1428075900 -0400 |
| 13 | committer aditya <dev@chimeracoder.net> 1428075900 -0400 |
| 14 | |
| 15 | First commit. Create .gitignore` |
| 16 | result, err := CatFile(inputSha) |
| 17 | if err != nil { |
| 18 | t.Error(err) |
| 19 | return |
| 20 | } |
| 21 | |
| 22 | if strings.Trim(result, "\n\r") != strings.Trim(expected, "\n\r") { |
| 23 | |
| 24 | t.Errorf("Expected and result don't match:\n%s \n\n\nresult: \n%s", expected, result) |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | func Test_parseObjInitialCommit(t *testing.T) { |
| 29 | expected := Commit{ |