v1.0.0
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestNewContextCancelsWithParent(t *testing.T) {
|
||||
parent, cancelParent := context.WithCancel(context.Background())
|
||||
ctx, stop := NewContext(parent)
|
||||
t.Cleanup(stop)
|
||||
|
||||
cancelParent()
|
||||
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
case <-time.After(time.Second):
|
||||
t.Fatal("application context was not cancelled")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user