git-module

fork of https://git.lin.moe/gogs/git-module

git clone git://git.lin.moe/fork/git-module.git

 1package git
 2
 3import (
 4	"context"
 5	"testing"
 6
 7	"github.com/stretchr/testify/assert"
 8	"github.com/stretchr/testify/require"
 9)
10
11func TestRepository_CatFileBlob(t *testing.T) {
12	ctx := context.Background()
13
14	t.Run("not a blob", func(t *testing.T) {
15		_, err := testrepo.CatFileBlob(ctx, testrepoMarks[47].String())
16		assert.Equal(t, ErrNotBlob, err)
17	})
18
19	t.Run("get a blob, no full rev hash", func(t *testing.T) {
20		b, err := testrepo.CatFileBlob(ctx, testrepoMarks[34].String()[:4])
21		require.NoError(t, err)
22		assert.True(t, b.IsBlob())
23	})
24
25	t.Run("get a blob", func(t *testing.T) {
26		b, err := testrepo.CatFileBlob(ctx, testrepoMarks[34].String())
27		require.NoError(t, err)
28		assert.True(t, b.IsBlob())
29	})
30}