diff options
author | Michael Muré <batolettre@gmail.com> | 2018-07-14 22:11:38 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-07-14 22:11:38 +0200 |
commit | f8e07748743f7e66ff1adf101a797cb1bedfc140 (patch) | |
tree | b9754c9402c2e4f0a4236c6540431e9ee8666227 /repository/tree_entry_test.go | |
parent | 499669c144218704c0942860564325d76adb13e2 (diff) | |
download | git-bug-f8e07748743f7e66ff1adf101a797cb1bedfc140.tar.gz |
add TreeEntry to manage the talking with git mktree and git ls-tree
Diffstat (limited to 'repository/tree_entry_test.go')
-rw-r--r-- | repository/tree_entry_test.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/repository/tree_entry_test.go b/repository/tree_entry_test.go new file mode 100644 index 00000000..f798a8a9 --- /dev/null +++ b/repository/tree_entry_test.go @@ -0,0 +1,34 @@ +package repository + +import ( + "github.com/MichaelMure/git-bug/util" + "testing" +) + +func TestTreeEntryFormat(t *testing.T) { + + entries := []TreeEntry{ + {Blob, util.Hash("a85730cf5287d40a1e32d3a671ba2296c73387cb"), "name"}, + {Tree, util.Hash("a85730cf5287d40a1e32d3a671ba2296c73387cb"), "name"}, + } + + for _, entry := range entries { + _ = entry.Format() + } +} + +func TestTreeEntryParse(t *testing.T) { + lines := []string{ + "100644 blob 1e5ffaffc67049635ba7b01f77143313503f1ca1 .gitignore", + "040000 tree 728421fea4168b874bc1a8aa409d6723ef445a4e bug", + } + + for _, line := range lines { + _, err := ParseTreeEntry(line) + + if err != nil { + t.Fatal(err) + } + } + +} |