Skip to content

Commit 6e996c7

Browse files
committed
Add test
1 parent 03de41f commit 6e996c7

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

modules/git/attribute/checker_test.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"github.com/stretchr/testify/require"
1616
)
1717

18-
func Test_Checker(t *testing.T) {
18+
func Test_CheckerLanguageStatus(t *testing.T) {
1919
setting.AppDataPath = t.TempDir()
2020
repoPath := "../tests/repos/language_stats_repo"
2121
gitRepo, err := git.OpenRepository(t.Context(), repoPath)
@@ -57,8 +57,19 @@ func Test_Checker(t *testing.T) {
5757
assert.Equal(t, expectedAttrs(), attrs["i-am-a-python.p"])
5858
})
5959

60+
t.Run("Run git check-attr in bare repository using index", func(t *testing.T) {
61+
attrs, err := CheckAttributes(t.Context(), gitRepo, "", CheckAttributeOpts{
62+
Filenames: []string{"i-am-a-python.p"},
63+
Attributes: LinguistAttributes,
64+
Cached: true,
65+
})
66+
assert.NoError(t, err)
67+
assert.Len(t, attrs, 1)
68+
assert.Equal(t, expectedAttrs(), attrs["i-am-a-python.p"])
69+
})
70+
6071
if !git.DefaultFeatures().SupportCheckAttrOnBare {
61-
t.Skip("git version 2.40 is required to support run check-attr on bare repo")
72+
t.Skip("git version 2.40 is required to support run check-attr on bare repo without using index")
6273
return
6374
}
6475

0 commit comments

Comments
 (0)