(t *testing.T)
| 34 | } |
| 35 | |
| 36 | func TestTLog(t *testing.T) { |
| 37 | tb := new(tbLogger) |
| 38 | defer TLog(tb)() |
| 39 | defer log.SetFlags(log.Flags()) |
| 40 | log.SetFlags(0) |
| 41 | |
| 42 | log.Printf("hello") |
| 43 | log.Printf("hello\n") |
| 44 | log.Printf("some text\nand more text\n") |
| 45 | want := []string{ |
| 46 | "hello", |
| 47 | "hello", |
| 48 | "some text\nand more text", |
| 49 | } |
| 50 | if !reflect.DeepEqual(tb.log, want) { |
| 51 | t.Errorf("Got %q; want %q", tb.log, want) |
| 52 | } |
| 53 | } |