2018-07-14 23:11:38 +03:00
|
|
|
package repository
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2019-02-24 19:40:52 +03:00
|
|
|
|
2020-06-23 19:02:54 +03:00
|
|
|
"github.com/stretchr/testify/assert"
|
2018-07-14 23:11:38 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestTreeEntryFormat(t *testing.T) {
|
|
|
|
entries := []TreeEntry{
|
2020-07-01 20:39:02 +03:00
|
|
|
{Blob, Hash("a85730cf5287d40a1e32d3a671ba2296c73387cb"), "name"},
|
|
|
|
{Tree, Hash("a85730cf5287d40a1e32d3a671ba2296c73387cb"), "name"},
|
2018-07-14 23:11:38 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
2020-06-23 19:02:54 +03:00
|
|
|
assert.NoError(t, err)
|
2018-07-14 23:11:38 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|