From 54cd813d5d597d2692c6e7114d0e8cdb6051b3fa Mon Sep 17 00:00:00 2001 From: Adam Hicks Date: Thu, 10 Oct 2024 10:16:04 +0100 Subject: [PATCH] deadline test --- app_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app_test.go b/app_test.go index 9e7626e..b632b5d 100644 --- a/app_test.go +++ b/app_test.go @@ -336,6 +336,18 @@ func TestWaitFor(t *testing.T) { }, expErr: context.Canceled, }, + { + name: "time out", + ctx: func(t *testing.T) context.Context { + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Millisecond) + t.Cleanup(cancel) + return ctx + }, + ch: func(t *testing.T) chan int { + return nil + }, + expErr: context.DeadlineExceeded, + }, { name: "success", ctx: func(t *testing.T) context.Context {