Help us shape the future of Go! Take the 2026 Go Developer Survey

testutil

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package testutil holds the small assertions and waits shared across otherwise independent tests. It sits below every production package so tests share mechanics without importing another domain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(t testing.TB, err error)

func Database

func Database(t testing.TB) string

Database gives t an empty schema of its own in the Postgres server CS_TEST_DATABASE_URL names, and returns a URL whose search_path selects it. The schema is dropped when t ends. Without the variable, t is skipped.

func Equal

func Equal[T comparable](t testing.TB, got, want T, what string)

func Eventually

func Eventually(t testing.TB, timeout time.Duration, what string, ready func() bool)

func RemainsBlocked

func RemainsBlocked[T any](t testing.TB, done <-chan T, what string)

func Serve

func Serve(handler http.Handler, request *http.Request) *httptest.ResponseRecorder

func WaitForFile

func WaitForFile(t testing.TB, path string)

func Within

func Within(t testing.TB, done <-chan error, timeout time.Duration, what string)

func WriteScript

func WriteScript(t testing.TB, path, body string)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL