MCPcopy Create free account
hub / github.com/apache/dubbo-go / TestEncoder_Encode_JSONPretty

Function TestEncoder_Encode_JSONPretty

protocol/triple/openapi/encoder_test.go:51–64  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

49}
50
51func TestEncoder_Encode_JSONPretty(t *testing.T) {
52 e := NewEncoder()
53 openAPI := model.NewOpenAPI()
54 openAPI.Info.Title = "Test API"
55 openAPI.Info.Version = "1.0.0"
56
57 result, err := e.Encode(openAPI, "json", true)
58 if err != nil {
59 t.Fatalf("unexpected error: %v", err)
60 }
61 if !strings.Contains(result, " ") {
62 t.Error("pretty JSON should contain indentation")
63 }
64}
65
66func TestEncoder_Encode_JSONCompact(t *testing.T) {
67 e := NewEncoder()

Callers

nothing calls this directly

Calls 6

EncodeMethod · 0.95
NewOpenAPIFunction · 0.92
NewEncoderFunction · 0.85
FatalfMethod · 0.65
ContainsMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected