mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-10 05:22:23 +00:00
test: case-insensitive language name comparison
This commit is contained in:
parent
d47102badf
commit
0c3a5927bb
@ -6,6 +6,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/go-enry/go-enry/v2/data"
|
||||
@ -259,7 +260,10 @@ func (s *EnryTestSuite) TestGetLanguagesByFilename() {
|
||||
|
||||
for _, test := range tests {
|
||||
languages := GetLanguagesByFilename(test.filename, test.content, test.candidates)
|
||||
assert.Equal(s.T(), test.expected, languages, fmt.Sprintf("%v: languages = %v, expected: %v", test.name, languages, test.expected))
|
||||
assert.Equal(s.T(), len(test.expected), len(languages), fmt.Sprintf("%v: number of languages = %v, expected: %v", test.name, len(languages), len(test.expected)))
|
||||
for i := range languages { // case-insensitive name comparison
|
||||
assert.True(s.T(), strings.EqualFold(test.expected[i], languages[i]), fmt.Sprintf("%v: languages = %v, expected: %v", test.name, languages, test.expected))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user