MCPcopy
hub / github.com/geektutu/high-performance-go / test

Function test

charpter-3/code/hpg-timeout-goroutine/timeout_test.go:48–55  ·  view source on GitHub ↗
(t *testing.T, f func(chan bool))

Source from the content-addressed store, hash-verified

46}
47
48func test(t *testing.T, f func(chan bool)) {
49 t.Helper()
50 for i := 0; i < 1000; i++ {
51 timeout(f)
52 }
53 time.Sleep(time.Second * 2)
54 t.Log(runtime.NumGoroutine())
55}
56
57func TestBadTimeout(t *testing.T) { test(t, doBadthing) }
58func TestGoodTimeout(t *testing.T) { test(t, doGoodthing) }

Callers 2

TestBadTimeoutFunction · 0.70
TestGoodTimeoutFunction · 0.70

Calls 1

timeoutFunction · 0.85

Tested by

no test coverage detected