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

Function TestParseExamplesFromLong_BasicBlock

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

Source from the content-addressed store, hash-verified

484}
485
486func TestParseExamplesFromLong_BasicBlock(t *testing.T) {
487 long := `Create a new item.
488
489Examples:
490 pad item create task "fix bug" --priority high
491 pad item create idea "feature x"
492
493Run with --help-collections to see available collections.`
494
495 got := parseExamplesFromLong(long)
496 if len(got) != 2 {
497 t.Fatalf("expected 2 examples, got %d: %+v", len(got), got)
498 }
499 if got[0].Cmd != `pad item create task "fix bug" --priority high` {
500 t.Errorf("example[0] = %q", got[0].Cmd)
501 }
502 if got[1].Cmd != `pad item create idea "feature x"` {
503 t.Errorf("example[1] = %q", got[1].Cmd)
504 }
505}
506
507func TestParseExamplesFromLong_NoHeader(t *testing.T) {
508 long := `Generate shell completion scripts.

Callers

nothing calls this directly

Calls 1

parseExamplesFromLongFunction · 0.85

Tested by

no test coverage detected