| 284 | } |
| 285 | |
| 286 | func TestHelperStack(t *testing.T) { |
| 287 | buf := new(bytes.Buffer) |
| 288 | SetOutput(buf) |
| 289 | defer SetOutput(os.Stdout) |
| 290 | |
| 291 | Error(context.Background(), errors.New("boo"), "failure x ", 0) |
| 292 | |
| 293 | read, err := ioutil.ReadAll(buf) |
| 294 | if err != nil { |
| 295 | t.Fatal("read buffer error:", err) |
| 296 | } |
| 297 | |
| 298 | got := string(read) |
| 299 | doNotWant := []string{ |
| 300 | "log.go:", |
| 301 | "i10r.io/log.Printkv", |
| 302 | "i10r.io/log.Error", |
| 303 | } |
| 304 | |
| 305 | t.Logf("output:\n%s", got) |
| 306 | for _, s := range doNotWant { |
| 307 | if strings.Contains(got, s) { |
| 308 | t.Errorf("output incorrectly contains %q", s) |
| 309 | } |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | func TestIsStackVal(t *testing.T) { |
| 314 | cases := []struct { |