| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
This package is not in the latest version of its module.
Go to latest Published: Aug 22, 2026 License: MITThe Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Modules with tagged versions give importers more predictable builds.
When a project reaches major version v1 it is considered stable.
Package assertauto provides helpers to automatically update the expected values of test assertions.
It compares actual values with expected values that are stored in files.
Run the tests with the environment variable ASSERTAUTO_UPDATE=true to update the expected values.
The values are stored in the "_assertauto" directory relative to the tested package. Each test creates a file with the name of the test and the ".txt" extension. Values of the same tests are stored sequentially in the same file.
The directory can be changed with the environment variable ASSERTAUTO_DIRECTORY. It must be a local path (see filepath.IsLocal). When ASSERTAUTO_UPDATE=true, this directory is removed at startup.
Values are converted to string using DefaultValueStringer.
Concurrency: functions in this package must not be called concurrently with the same test name. Values for a given test name are stored sequentially in a single file, and their order is significant: each call consumes the next expected value (in read mode) or appends the next actual value (in update mode). Concurrent calls sharing a test name make that order non-deterministic, causing flaky results: in update mode the file content varies between runs, and in read mode a call may be matched against the wrong expected value. By default the test name is testing.TB.Name, so concurrent calls must use distinct subtests (e.g. via testing.T.Run) rather than sharing a single testing.TB across goroutines.
This section is empty.
var ( // DefaultValueStringer is the default value stringer. // // By default it uses [assert.ValueStringer]. DefaultValueStringer atomicutil.Value[func(any) string] // DefaultDirectory is the default directory. // It can be set with the environment variable ASSERTAUTO_DIRECTORY. // It must be a local path (see [filepath.IsLocal]). // // By default it is "_assertauto". DefaultDirectory atomicutil.Value[string] // DefaultUpdate is the default update value. // It can be set with the environment variable ASSERTAUTO_UPDATE. // If the value is not a valid boolean, it panics during init(). // // By default it is false. DefaultUpdate atomic.Bool )
AllocsPerRun asserts that a function allocates a certain number of times per run.
If the race detector is enabled, this function skips the test with testing.TB.Skip because testing.AllocsPerRun reports inaccurate allocations under -race.
It must not be called concurrently with the same test name. See the package documentation for details.
Equal asserts that the value is equal to the expected value.
It must not be called concurrently with the same test name. See the package documentation for details.
type Option func(*options)
Option is an option for assertauto.
AssertOptions returns an Option that sets the assert options.
| Back | FazBrowse Home | New Git URL |