Skip to main content

Crate test_better_core

Crate test_better_core 

Source
Expand description

test-better-core: error and result types.

This crate is the foundation of the test-better testing library. It makes ? viable as the single control-flow operator of a test by providing:

Structs§

ContextFrame
One human-readable frame in a TestError’s context chain.
SourceLocation
A source location, owned and serializable (the plain-data form of std::panic::Location).
StructuredContextFrame
The plain-data form of crate::ContextFrame.
StructuredError
The plain-data, owned, serializable mirror of TestError.
TestError
A test failure.
Trace
A scoped collector of in-test breadcrumbs.

Enums§

ColorChoice
When rendered failures should use ANSI color.
ErrorKind
The category of a TestError.
Payload
Structured detail attached to a TestError beyond its message.
StructuredPayload
The plain-data form of Payload.
TraceEntry
One breadcrumb recorded on a Trace.

Constants§

RUNNER_ENV
The environment variable the runner sets on the cargo test it spawns.
STRUCTURED_MARKER
The sentinel that brackets the JSON structured-error payload on its own line in captured test output. Chosen to be unmistakable in prose and to sit alone on a line.

Traits§

ContextExt
Attaches context to the failure path of a Result or the None of an Option.
OrFail
Converts a fallible value into a TestResult, producing a TestError on the failure path.

Functions§

color_choice
Returns the process-wide ColorChoice.
set_color_choice
Sets the process-wide ColorChoice for rendered failures.

Type Aliases§

TestResult
The result type returned by test-better tests and helpers.