blob: 8522c6f453a3469d7dc9991c2002dc0fb20dde4f (
plain)
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
|
package linguist
import (
"path/filepath"
"testing"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/config"
_ "gitlab.com/gitlab-org/gitaly/internal/testhelper" // Side effect: set up config.Config
)
func TestLoadLanguages(t *testing.T) {
colorMap = make(map[string]Language)
require.NoError(t, LoadColors(), "load colors")
require.Equal(t, "#701516", Color("Ruby"), "color value for 'Ruby'")
}
func TestLoadLanguagesCustomPath(t *testing.T) {
jsonPath, err := filepath.Abs("testdata/fake-languages.json")
require.NoError(t, err)
config.Config.Ruby.LinguistLanguagesPath = jsonPath
colorMap = make(map[string]Language)
require.NoError(t, LoadColors(), "load colors")
require.Equal(t, "foo color", Color("FooBar"))
}
|