MCPcopy Index your code
hub / github.com/bracesdev/errtrace / TestBuildTreeMulti

Function TestBuildTreeMulti

tree_test.go:44–68  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

42}
43
44func TestBuildTreeMulti(t *testing.T) {
45 tree := buildTraceTree(errorMultiCaller())
46
47 if want, got := 0, len(tree.Trace); want != got {
48 t.Fatalf("unexpected trace: %v", tree.Trace)
49 }
50
51 if want, got := 2, len(tree.Children); want != got {
52 t.Fatalf("children length mismatch, want %d, got %d", want, got)
53 }
54
55 for _, child := range tree.Children {
56 if want, got := 2, len(child.Trace); want != got {
57 t.Fatalf("trace length mismatch, want %d, got %d", want, got)
58 }
59
60 if want, got := "braces.dev/errtrace.errorCallee", child.Trace[0].Function; want != got {
61 t.Errorf("innermost function should be first, want %q, got %q", want, got)
62 }
63
64 if want, got := "braces.dev/errtrace.errorCaller", child.Trace[1].Function; want != got {
65 t.Errorf("outermost function should be last, want %q, got %q", want, got)
66 }
67 }
68}
69
70func TestWriteTree(t *testing.T) {
71 type testFrame struct {

Callers

nothing calls this directly

Calls 2

buildTraceTreeFunction · 0.85
errorMultiCallerFunction · 0.85

Tested by

no test coverage detected