Discover Packages
github.com/parandor/samples
internal
assert
package
Version:
v0.0.0-...-a04e50b
Opens a new window with list of versions in this module.
Published: Aug 5, 2024
License: GPL-3.0
Opens a new window with license information.
Imports: 8
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Jump to ...
Documentation
Overview
Index
Constants
Variables
Functions
Equal(tb, got, want, options)
ErrorIs(tb, got, want, options)
False(tb, got, options)
Match(tb, got, want, options)
Nil(tb, got, options)
NotEqual(tb, got, want, options)
NotNil(tb, got, options)
NotZero(tb, got, options)
Panics(tb, panicker, options)
True(tb, got, options)
Zero(tb, got, options)
Types
Source Files
Documentation
Documentation
¶
Package assert is a minimal assert package using generics.
This prevents connect from needing additional dependencies.
func Equal[T any](tb testing.TB, got, want T, options ...Option) bool
func ErrorIs(tb testing.TB, got, want error, options ...Option) bool
func False(tb testing.TB, got bool, options ...Option) bool
func Match(tb testing.TB, got, want string, options ...Option) bool
func Nil(tb testing.TB, got any, options ...Option) bool
func NotEqual[T any](tb testing.TB, got, want T, options ...Option) bool
func NotNil(tb testing.TB, got any, options ...Option) bool
func NotZero[T any](tb testing.TB, got T, options ...Option) bool
func Panics(tb testing.TB, panicker func(), options ...Option)
func True(tb testing.TB, got bool, options ...Option) bool
func Zero[T any](tb testing.TB, got T, options ...Option) bool
type Option
Equal asserts that two values are equal.
ErrorIs asserts that "want" is in "got's" error chain. See the standard
library's errors package for details on error chains. On failure, output is
identical to Equal.
False asserts that "got" is false.
Match asserts that the value matches a regexp.
Nil asserts that the value is nil.
NotEqual asserts that two values aren't equal.
NotNil asserts that the value isn't nil.
NotZero asserts that the value is non-zero.
Panics asserts that the function called panics.
True asserts that "got" is true.
Zero asserts that the value is its type's zero value.
type Option interface {
}
An Option configures an assertion.
Sprintf adds a user-defined message to the assertion's output. The arguments
are passed directly to fmt.Sprintf for formatting.
If Sprintf is passed multiple times, only the last message is used.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.