(t *testing.T)
| 42 | } |
| 43 | |
| 44 | func 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 | |
| 70 | func TestWriteTree(t *testing.T) { |
| 71 | type testFrame struct { |
nothing calls this directly
no test coverage detected