| 113 | } |
| 114 | |
| 115 | func TestDebuggerSection(t *testing.T) { |
| 116 | mux := http.NewServeMux() |
| 117 | dbg := Debugger(mux) |
| 118 | dbg.Section(func(w io.Writer, r *http.Request) { |
| 119 | fmt.Fprintf(w, "Test output %v", r.RemoteAddr) |
| 120 | }) |
| 121 | |
| 122 | code, body := get(mux, "/debug/", tsIP) |
| 123 | if code != 200 { |
| 124 | t.Fatalf("debug access failed, got %v", code) |
| 125 | } |
| 126 | want := `Test output 100.100.100.100:1234` |
| 127 | if !strings.Contains(body, want) { |
| 128 | t.Errorf("want %q in output, not found", want) |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | func TestDebuggerHandle(t *testing.T) { |
| 133 | mux := http.NewServeMux() |