Skip to content

Commit

Permalink
add a test for file ext based format detection
Browse files Browse the repository at this point in the history
  • Loading branch information
ryenus committed Aug 5, 2024
1 parent 0e7f9ad commit 6298fe0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/yqlib/format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,13 @@ func TestFormatFromString(t *testing.T) {
}
}
}

func TestFormatStringFromFilename(t *testing.T) {
test.AssertResult(t, "yaml", FormatStringFromFilename("test.Yaml"))
test.AssertResult(t, "yaml", FormatStringFromFilename("test.index.Yaml"))
test.AssertResult(t, "yaml", FormatStringFromFilename("test"))
test.AssertResult(t, "json", FormatStringFromFilename("test.json"))
test.AssertResult(t, "json", FormatStringFromFilename("TEST.JSON"))
test.AssertResult(t, "yaml", FormatStringFromFilename("test.json/foo"))
test.AssertResult(t, "yaml", FormatStringFromFilename(""))
}

0 comments on commit 6298fe0

Please sign in to comment.