stop-and-go
Testing helper for concurrency
About stop-and-go
stop-and-go
Testing helper for concurrency
Install
go get -u github.com/elgohr/stop-and-go
Usage
func TestExample(t *testing.T) {
w1 := wait.NewWaiter(time.Second)
w2 := wait.NewWaiter(time.Second)
w3 := wait.NewWaiter(time.Second)
ts1 := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w2.Done()
}))
defer ts1.Close()
go func() {
w3.Done()
}()
go func() {
if _, err := http.Get(ts1.URL); err != nil {
t.Error(err)
}
w1.Done()
}()
if err := wait.For(
constraint.NoOrder(w3),
constraint.Before(w1, w2),
); err != nil {
t.Error(err)
}
}
Frequently Asked Questions
What is stop-and-go?
stop-and-go is a Testing library for the Go programming language. Testing helper for concurrency
How do I install stop-and-go?
Install stop-and-go with the Go module system using `go get elgohr/stop-and-go`. Check the repository for the current installation instructions.
What category does stop-and-go belong to?
stop-and-go is listed under Testing, specifically Testing Frameworks.