diff --git a/main_test.go b/main_test.go new file mode 100644 index 00000000..336be71c --- /dev/null +++ b/main_test.go @@ -0,0 +1,17 @@ +package websocket_test + +import ( + "fmt" + "os" + "runtime" + "testing" +) + +func TestMain(m *testing.M) { + code := m.Run() + if runtime.NumGoroutine() != 1 { + fmt.Fprintf(os.Stderr, "goroutine leak detected, expected 1 but got %d goroutines\n", runtime.NumGoroutine()) + os.Exit(1) + } + os.Exit(code) +}