Standard library / testing
testing.T
Represents one test. Obtain it from go test, not by constructing a zero value. Expected stdout: 'verified\nPASS\n'. Run as a _test.go file using the Go test harness.
Formal Syntax & Structure
go syntaxgo
type T struct {}Working Example
Example Snippetgo
package main
import ( "fmt" "testing")
func TestReference(t *testing.T) { if 2+2 != 4 { t.Fatal("arithmetic") } fmt.Println("verified")}