From 7db593cb3220e52b56292cbaec954c6f2c7c2fd7 Mon Sep 17 00:00:00 2001 From: Alex Bezzubov Date: Fri, 22 Sep 2023 14:36:21 +0200 Subject: [PATCH] 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 --- utils.go | 15 ++++++++------- utils_test.go | 1 + 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/utils.go b/utils.go index 5e18300..db5e30b 100644 --- a/utils.go +++ b/utils.go @@ -12,15 +12,16 @@ import ( const binSniffLen = 8000 var configurationLanguages = map[string]struct{}{ - "XML": {}, - "JSON": {}, - "TOML": {}, - "YAML": {}, - "INI": {}, - "SQL": {}, + "XML": {}, + "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] diff --git a/utils_test.go b/utils_test.go index 4d426c1..c1817a6 100644 --- a/utils_test.go +++ b/utils_test.go @@ -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 {