Skip to content

Commit 61d36fb

Browse files
ldemaillydeadprogram
authored andcommitted
Add missing T.Deadline
1 parent b318a94 commit 61d36fb

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/testing/testing.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,10 +463,23 @@ func (t *T) Run(name string, f func(t *T)) bool {
463463
return !sub.failed
464464
}
465465

466+
// Deadline reports the time at which the test binary will have
467+
// exceeded the timeout specified by the -timeout flag.
468+
//
469+
// The ok result is false if the -timeout flag indicates “no timeout” (0).
470+
// For now tinygo always return 0, false.
471+
//
472+
// Not Implemented.
473+
func (t *T) Deadline() (deadline time.Time, ok bool) {
474+
deadline = t.context.deadline
475+
return deadline, !deadline.IsZero()
476+
}
477+
466478
// testContext holds all fields that are common to all tests. This includes
467479
// synchronization primitives to run at most *parallel tests.
468480
type testContext struct {
469-
match *matcher
481+
match *matcher
482+
deadline time.Time
470483
}
471484

472485
func newTestContext(m *matcher) *testContext {

0 commit comments

Comments
 (0)