Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2022-09-09 10:51:38 +0300
committerToon Claes <toon@gitlab.com>2022-10-03 16:26:16 +0300
commit1c491ca68bfb4b28453befa0b562c275bc18c2f8 (patch)
tree9c62929a74ac1d8790e54e46fded50b76e5528a8
parente720e48209b996acf23e0c8101fee6116be89cc5 (diff)
linguist: Rewrite Color tests
To have a little bit of insurance the colors on the languages don't change at random, test a handful of languages and their color.
-rw-r--r--internal/gitaly/linguist/linguist_test.go21
1 files changed, 19 insertions, 2 deletions
diff --git a/internal/gitaly/linguist/linguist_test.go b/internal/gitaly/linguist/linguist_test.go
index 18ee7e906..6e9887074 100644
--- a/internal/gitaly/linguist/linguist_test.go
+++ b/internal/gitaly/linguist/linguist_test.go
@@ -290,13 +290,30 @@ func TestInstance_Stats_unmarshalJSONError(t *testing.T) {
require.False(t, ok, "expected the error not be a json Syntax Error")
}
-func TestNew(t *testing.T) {
+func TestInstance_Color(t *testing.T) {
+ t.Parallel()
+
cfg := testcfg.Build(t, testcfg.WithRealLinguist())
ling, err := New(cfg)
require.NoError(t, err)
- require.Equal(t, "#701516", ling.Color("Ruby"), "color value for 'Ruby'")
+ for _, tc := range []struct {
+ language string
+ expectedColor string
+ }{
+ {language: "Go", expectedColor: "#00ADD8"},
+ {language: "Ruby", expectedColor: "#701516"},
+ {language: "HTML", expectedColor: "#e34c26"},
+ {language: "Markdown", expectedColor: "#083fa1"},
+ {language: "Javascript", expectedColor: "#75712c"},
+ {language: "SSH Config", expectedColor: "#2d519e"},
+ {language: "Wozzle Wuzzle", expectedColor: "#3adbcf"}, // non-existing language
+ } {
+ t.Run(tc.language, func(t *testing.T) {
+ require.Equal(t, tc.expectedColor, ling.Color(tc.language), "color value for '%v'", tc.language)
+ })
+ }
}
func TestNew_loadLanguagesCustomPath(t *testing.T) {