Standard library / testing

testing.T.Deadline()

Return the test binary deadline and whether it exists; the fixture sets -test.timeout=10s. Expected stdout: 'true true\nPASS\n'. Run as a _test.go file using the Go test harness.

Formal Syntax & Structure

go syntaxgo
func (t *T) Deadline() (deadline time.Time, ok bool)

Return Value

(deadline time.Time, ok bool)

Result of the operation described above.

Working Example

Example Snippetgo
package main
import (  "fmt"  "testing"  "time")
func TestReference(t *testing.T) { d, ok := t.Deadline(); fmt.Println(ok, d.After(time.Now())) }
Go Reference