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

compattest

package
v1.4.15 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package compattest runs a test body in both ADR 0021 compat modes.

Tests select a mode with Set or Both, never with a bare compat.V15() branch (scripts/ci/compat-markers.sh scans non-test files only).

Layer: L0. Imports the standard library and internal/compat only.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Both

func Both(t *testing.T, fn func(t *testing.T))

Both runs fn as two subtests, "v1.4" then "v1.5", with the matching mode selected through Set. Each run observes the matching compat.V15() value.

func Set

func Set(t testing.TB, on bool)

Set selects v1.5 behaviour when on is true and v1.4 behaviour otherwise for the duration of t. It uses t.Setenv, so the previous value is restored when the test ends and the test cannot run in parallel.

Types

This section is empty.

Jump to

Keyboard shortcuts

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