Commit 88760611 authored by Jack Lindamood's avatar Jack Lindamood Committed by Sameer Ajmani

context: add test for WithDeadline in the past

Adds a test case for calling context.WithDeadline() where the deadline
exists in the past.  This change increases the code coverage of the
context package.

Change-Id: Ib486bf6157e779fafd9dab2b7364cdb5a06be36e
Reviewed-on: https://go-review.googlesource.com/25007Reviewed-by: 's avatarSameer Ajmani <sameer@golang.org>
Run-TryBot: Sameer Ajmani <sameer@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent ea2376fc
...@@ -255,6 +255,12 @@ func TestDeadline(t *testing.T) { ...@@ -255,6 +255,12 @@ func TestDeadline(t *testing.T) {
o = otherContext{c} o = otherContext{c}
c, _ = WithDeadline(o, time.Now().Add(4*time.Second)) c, _ = WithDeadline(o, time.Now().Add(4*time.Second))
testDeadline(c, "WithDeadline+otherContext+WithDeadline", 2*time.Second, t) testDeadline(c, "WithDeadline+otherContext+WithDeadline", 2*time.Second, t)
c, _ = WithDeadline(Background(), time.Now().Add(-time.Millisecond))
testDeadline(c, "WithDeadline+inthepast", time.Second, t)
c, _ = WithDeadline(Background(), time.Now())
testDeadline(c, "WithDeadline+now", time.Second, t)
} }
func TestTimeout(t *testing.T) { func TestTimeout(t *testing.T) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment