aboutsummaryrefslogtreecommitdiffstats
path: root/repository/tree_entry_test.go
blob: f798a8a983afd0772765203489ed9b34a18111af (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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)
		}
	}

}