MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / TestEmitJSON_ProducesValidJSON

Function TestEmitJSON_ProducesValidJSON

internal/cmdhelp/json_test.go:412–428  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

410}
411
412func TestEmitJSON_ProducesValidJSON(t *testing.T) {
413 root := buildSyntheticTree()
414 var buf bytes.Buffer
415 if err := EmitJSON(root, root, Options{Binary: "padtest", MaxDepth: -1}, &buf); err != nil {
416 t.Fatalf("EmitJSON: %v", err)
417 }
418 var parsed map[string]interface{}
419 if err := json.Unmarshal(buf.Bytes(), &parsed); err != nil {
420 t.Fatalf("emitted output is not valid JSON: %v\n%s", err, buf.String())
421 }
422 // Required top-level keys per cmdhelp v0.1 §3.
423 for _, k := range []string{"cmdhelp_version", "binary", "commands"} {
424 if _, ok := parsed[k]; !ok {
425 t.Errorf("emitted JSON missing required top-level key %q", k)
426 }
427 }
428}
429
430func TestCapabilityLine_FormatExact(t *testing.T) {
431 got := CapabilityLine([]string{"text", "md", "json", "llm"})

Callers

nothing calls this directly

Calls 3

buildSyntheticTreeFunction · 0.85
EmitJSONFunction · 0.85
StringMethod · 0.80

Tested by

no test coverage detected