MCPcopy Create free account
hub / github.com/Enapiuz/multiwatch / TestPrinter_Start

Function TestPrinter_Start

printer/printer_test.go:42–61  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

40}
41
42func 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}

Callers

nothing calls this directly

Calls 3

RegisterWatchersMethod · 0.95
StartMethod · 0.95
NewPrinterFunction · 0.85

Tested by

no test coverage detected