Standard library / testing

testing.T.SkipNow()

Mark skipped and stop the current test goroutine; use only from that goroutine. Expected stdout: 'cleanup\nPASS\n'. Run as a _test.go file using the Go test harness.

Formal Syntax & Structure

go syntaxgo
func (c *T) SkipNow()

Working Example

Example Snippetgo
package main
import (  "fmt"  "testing")
func TestReference(t *testing.T) { t.Cleanup(func() { fmt.Println("cleanup") }); t.SkipNow() }
Go Reference