github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/builtins/core/pretty/pretty_test.go (about) 1 package pretty 2 3 import ( 4 "testing" 5 6 _ "github.com/lmorg/murex/builtins/types/generic" 7 _ "github.com/lmorg/murex/builtins/types/json" 8 "github.com/lmorg/murex/lang/types" 9 "github.com/lmorg/murex/test" 10 ) 11 12 func TestPrettyDefault(t *testing.T) { 13 input := `{"foo":"bar"}` 14 output := "{\n \"foo\": \"bar\"\n}" 15 16 test.RunMethodTest(t, cmdPretty, "pretty", input, types.Json, []string{}, output, nil) 17 test.RunMethodTest(t, cmdPretty, "pretty", input, types.Generic, []string{}, output, nil) 18 } 19 20 func TestPrettyStrict(t *testing.T) { 21 input := `{"foo":"bar"}` 22 output := "{\n \"foo\": \"bar\"\n}" 23 24 test.RunMethodTest(t, cmdPretty, "pretty", input, types.Json, []string{"--strict"}, output, nil) 25 test.RunMethodTest(t, cmdPretty, "pretty", input, types.Generic, []string{"--strict"}, input, nil) 26 }