mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-06 18:24:57 +08:00
Default to yaml when a file's extension is not a recognised format (#2785)
* Default to yaml for unrecognised file extensions in format auto-detection * Add test for unrecognised extension defaulting to yaml
This commit is contained in:
@@ -59,4 +59,7 @@ func TestFormatStringFromFilename(t *testing.T) {
|
||||
test.AssertResult(t, "json", FormatStringFromFilename("TEST.JSON"))
|
||||
test.AssertResult(t, "yaml", FormatStringFromFilename("test.json/foo"))
|
||||
test.AssertResult(t, "yaml", FormatStringFromFilename(""))
|
||||
// unrecognised extensions should default to yaml instead of being passed through verbatim
|
||||
// (see https://github.com/mikefarah/yq/issues/1608)
|
||||
test.AssertResult(t, "yaml", FormatStringFromFilename("test.tfstate"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user