(t *testing.T)
| 40 | } |
| 41 | |
| 42 | func TestPrinter_Start(t *testing.T) { |
| 43 | rescueStdout := os.Stdout |
| 44 | r, w, _ := os.Pipe() |
| 45 | os.Stdout = w |
| 46 | |
| 47 | testPrinter := NewPrinter() |
| 48 | dumbWatcher := &WatcherMock{} |
| 49 | testPrinter.RegisterWatchers([]watcher.Interface{dumbWatcher}) |
| 50 | needReprint := make(chan bool) |
| 51 | testPrinter.Start(needReprint) |
| 52 | needReprint <- true |
| 53 | |
| 54 | time.Sleep(1 * time.Second) |
| 55 | w.Close() |
| 56 | out, _ := ioutil.ReadAll(r) |
| 57 | os.Stdout = rescueStdout |
| 58 | |
| 59 | assert.Contains(t, string(out), "status_log") |
| 60 | assert.Contains(t, string(out), "error_log") |
| 61 | } |
nothing calls this directly
no test coverage detected