IsConfiguration: add&fix failing Python case to Go

test plan:
 * ENRY_TEST_REPO=".linguist" \
    go test -run '^TestIsConfiguration$' github.com/go-enry/go-enry/v2
This commit is contained in:
Alex Bezzubov 2023-09-22 14:36:21 +02:00
parent 84c996dfcf
commit 7db593cb32
2 changed files with 9 additions and 7 deletions

View File

@ -16,11 +16,12 @@ var configurationLanguages = map[string]struct{}{
"JSON": {},
"TOML": {},
"YAML": {},
"MiniYAML": {},
"INI": {},
"SQL": {},
}
// IsConfiguration tells if filename is in one of the configuration languages.
// IsConfiguration tells if a give file is in one of the configuration languages.
func IsConfiguration(path string) bool {
language, _ := GetLanguageByExtension(path)
_, is := configurationLanguages[language]

View File

@ -139,6 +139,7 @@ func TestIsConfiguration(t *testing.T) {
{name: "TestIsConfiguration_1", path: "foo", expected: false},
{name: "TestIsConfiguration_2", path: "foo.ini", expected: true},
{name: "TestIsConfiguration_3", path: "/test/path/foo.json", expected: true},
{name: "TestIsConfiguration_YAML", path: "configuration.yml", expected: true},
}
for _, test := range tests {