Refactoring JSON encoder prefs

This commit is contained in:
Mike Farah
2024-02-24 15:48:59 +11:00
parent 7a01e216c4
commit 55f6a3a49d
9 changed files with 76 additions and 21 deletions
+6 -2
View File
@@ -314,7 +314,9 @@ func TestPrinterMultipleDocsJson(t *testing.T) {
var writer = bufio.NewWriter(&output)
// note printDocSeparators is true, it should still not print document separators
// when outputting JSON.
encoder := NewJSONEncoder(0, false, false)
prefs := ConfiguredJsonPreferences.Copy()
prefs.Indent = 0
encoder := NewJSONEncoder(prefs)
if encoder == nil {
t.Skipf("no support for %s output format", "json")
}
@@ -366,7 +368,9 @@ func TestPrinterNulSeparatorWithJson(t *testing.T) {
var writer = bufio.NewWriter(&output)
// note printDocSeparators is true, it should still not print document separators
// when outputting JSON.
encoder := NewJSONEncoder(0, false, false)
prefs := ConfiguredJsonPreferences.Copy()
prefs.Indent = 0
encoder := NewJSONEncoder(prefs)
if encoder == nil {
t.Skipf("no support for %s output format", "json")
}