ehttptest

package
v0.0.0-...-63e4bc9 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ehttptest holds the conventions shared by every ehttp test: each assertion carries its basis (a spec section or a reason), and known bugs run as strict expected failures.

Index

Constants

View Source
const PendingEnv = "EHTTP_PENDING"

PendingEnv selects the pending mode of KnownBug when it is not empty.

Variables

This section is empty.

Functions

func Do

Do serves req through h in memory and returns the recorded response.

func Eq

func Eq[T comparable](t testing.TB, basis string, got, want T)

Eq fails t when got != want. basis names why the expectation holds, e.g. "RFC 9110 §15.5.6".

func KnownBug

func KnownBug(t *testing.T, name string, check func(t testing.TB))

KnownBug runs check for the open defect name. The name is a kebab-case description of the defect, for example "sample-bug". A test that covers two defects joins the names with "+". The check asserts the correct behavior. Use it like this:

ehttptest.KnownBug(t, "sample-bug", func(t testing.TB) {
	ehttptest.Eq(t, "RFC 9110 §1", got, want)
})

Default mode: a failure of check fails the test with a message that starts with "pending <name>:". A pass is a pass. This is the TDD view (red until the bug is fixed).

Pending mode (EHTTP_PENDING set): a failure skips the test with the same "pending <name>:" prefix, so a gate can stay green and list the open work. A pass fails the test, so a fixed bug forces its marker to be removed.

Keep setup (ports, fixtures, servers) outside check: in pending mode a Fatal inside check is reported as pending, not as a setup failure.

func True

func True(t testing.TB, basis string, cond bool, format string, args ...any)

True fails t when cond is false.

Types

This section is empty.

Jump to

Keyboard shortcuts

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