MCPcopy Create free account
hub / github.com/driangle/taskmd / TestToASCII_WithFormatter_Reference

Function TestToASCII_WithFormatter_Reference

sdk/go/graph/graph_test.go:479–522  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

477}
478
479func TestToASCII_WithFormatter_Reference(t *testing.T) {
480 // Create a graph with a diamond shape so a node is visited twice
481 tasks := []*model.Task{
482 {
483 ID: "T1",
484 Title: "Root",
485 Status: model.StatusPending,
486 Dependencies: []string{},
487 },
488 {
489 ID: "T2",
490 Title: "Left",
491 Status: model.StatusPending,
492 Dependencies: []string{"T1"},
493 },
494 {
495 ID: "T3",
496 Title: "Right",
497 Status: model.StatusPending,
498 Dependencies: []string{"T1"},
499 },
500 {
501 ID: "T4",
502 Title: "Bottom",
503 Status: model.StatusPending,
504 Dependencies: []string{"T2", "T3"},
505 },
506 }
507
508 g := NewGraph(tasks)
509
510 f := &ASCIIFormatter{
511 FormatReference: func(text string) string {
512 return "<REF:" + text + ">"
513 },
514 }
515
516 output := g.ToASCII("T1", true, f)
517
518 // T4 appears under both T2 and T3, so the second occurrence should have "(see above)"
519 if !strings.Contains(output, "<REF:(see above)>") {
520 t.Errorf("Expected formatted reference text, got:\n%s", output)
521 }
522}

Callers

nothing calls this directly

Calls 2

ToASCIIMethod · 0.95
NewGraphFunction · 0.85

Tested by

no test coverage detected