Documentation
¶
Index ¶
- Variables
- func DiagnosticError(a, e any) error
- func DiagnosticErrors(a, e any) error
- func Equal(actual, expected any) error
- func EqualJSON(actual, expected any) error
- func Error(actual any) error
- func Expect(t *testing.T, fn Binary, actual, expected any, desc ...string)
- func ExpectThat(t *testing.T, fn Unary, actual any, desc ...string)
- func HaveSameItems(actual, expected any) error
- func IsSameAssertion(a, b Assertion) bool
- func Nil(actual any) error
- func NotNil(actual any) error
- type Assertion
- type Binary
- type ExpectedError
- type ExpectedMultiError
- type Unary
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ShouldBeNil = NewUnaryAssertion(Nil) ShouldBeError = NewUnaryAssertion(Error) ShouldNotBeNil = NewUnaryAssertion(NotNil) ShouldBeDiagnosticError = NewBinaryAssertion(DiagnosticError) ShouldBeDiagnosticErrors = NewBinaryAssertion(DiagnosticErrors) ShouldEqual = NewBinaryAssertion(Equal) ShouldHaveSameItems = NewBinaryAssertion(HaveSameItems) ShouldEqualJSON = NewBinaryAssertion(EqualJSON) ShouldNotReach = func(t *testing.T, _ any, _ ...any) { t.Helper() t.Fatal("this assertion should not be reached") } )
Functions ¶
func DiagnosticError ¶
func DiagnosticErrors ¶
func EqualJSON ¶
EqualJSON compares actual and expected by JSON-encoding both values. This normalizes numeric types (e.g., int vs float64) and map ordering.
func HaveSameItems ¶
func IsSameAssertion ¶
Types ¶
type Binary ¶
func ComposeBinary ¶
type ExpectedError ¶
type ExpectedError struct {
Message string
Kind diagnostics.Kind
Hint string
Format string
}
func CastExpectedError ¶
func CastExpectedError(err any) (*ExpectedError, bool)
type ExpectedMultiError ¶
type ExpectedMultiError struct {
Errors []*ExpectedError
Number int
}
func CastExpectedMultiError ¶
func CastExpectedMultiError(err any) (*ExpectedMultiError, bool)
Click to show internal directories.
Click to hide internal directories.