MCPcopy
hub / github.com/teivah/100-go-mistakes / TestGetBestFoo2

Function TestGetBestFoo2

src/11-testing/86-sleeping/main_test.go:62–79  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

60}
61
62func TestGetBestFoo2(t *testing.T) {
63 mock := publisherMock2{
64 ch: make(chan []Foo),
65 }
66 defer close(mock.ch)
67
68 h := Handler{
69 publisher: &mock,
70 n: 2,
71 }
72 foo := h.getBestFoo(42)
73 // Check foo
74 _ = foo
75
76 if v := len(<-mock.ch); v != 2 {
77 t.Fatalf("expected 2, got %d", v)
78 }
79}

Callers

nothing calls this directly

Calls 2

getBestFooMethod · 0.95
makeFunction · 0.85

Tested by

no test coverage detected