Documentation
¶
Index ¶
- Variables
- func All(ms ...any) types.BeMatcher
- func Always() types.BeMatcher
- func Any(ms ...any) types.BeMatcher
- func ContainElement(element any) types.BeMatcher
- func ContainElements(elements ...any) types.BeMatcher
- func Dive(matcher any) types.BeMatcher
- func DiveAny(matcher any) types.BeMatcher
- func DiveFirst(matcher any) types.BeMatcher
- func DiveNth(n int, matcher any) types.BeMatcher
- func Eq(expected any) types.BeMatcher
- func False() types.BeMatcher
- func HaveKey(key any) types.BeMatcher
- func HaveKeyWithValue(key, value any) types.BeMatcher
- func HaveLength(args ...any) types.BeMatcher
- func HaveOccurred() types.BeMatcher
- func MatchError(expected any) types.BeMatcher
- func Never(err error) types.BeMatcher
- func Nil() types.BeMatcher
- func Not(expected any) types.BeMatcher
- func NotNil() types.BeMatcher
- func NotPanic() types.BeMatcher
- func Panic() types.BeMatcher
- func Succeed() types.BeMatcher
- func True() types.BeMatcher
- type Expectation
- type TestingT
Constants ¶
This section is empty.
Variables ¶
var Ctx = be_ctx.Ctx
Ctx is an alias for be_ctx.Ctx
var HttpRequest = be_http.Request
HttpRequest is an alias for be_http.Request matcher
var JSON = be_json.Matcher
JSON is an alias for be_json.JSON matcher
var JwtToken = be_jwt.Token
JwtToken is an alias for be_jwt.Token matcher
var StringAsTemplate = be_string.MatchTemplate
StringAsTemplate is an alias for be_string.MatchTemplate matcher
var URL = be_url.URL
URL is an alias for be_url.URL matcher
Functions ¶
func ContainElement ¶
ContainElement succeeds if actual (a slice, array or map) contains an element that matches the given value or matcher.
func ContainElements ¶
ContainElements succeeds if actual contains all of the given elements (each may be a value or a matcher), in any order.
func Dive ¶ added in v0.2.0
Dive applies the given matcher to each (every) element of a slice or array, or to each value of a map. Note: Dive is very close to gomega.HaveEach
func DiveAny ¶ added in v0.2.0
DiveAny applies the given matcher to each element and succeeds in case if it succeeds at least at one item
func DiveFirst ¶ added in v0.2.0
DiveFirst applies the given matcher to the first element of the given slice
func DiveNth ¶ added in v0.2.2
DiveNth applies the given matcher to the nth element of the given slice
func HaveKeyWithValue ¶
HaveKeyWithValue succeeds if actual (a map) has the given key with a matching value.
func HaveLength ¶
HaveLength is like gomega.HaveLen() HaveLength succeeds if the actual value has a length that matches the provided conditions. It accepts either a count value or one or more Gomega matchers to specify the desired length conditions.
func HaveOccurred ¶
HaveOccurred succeeds if actual is a non-nil error.
func MatchError ¶
MatchError succeeds if actual is an error matching expected, which may be:
- a target error (compared with errors.Is),
- a string (compared against err.Error()),
- a matcher applied to the error.
func Nil ¶
Nil succeeds if actual is nil. It is typed-nil aware (a nil *T inside an interface matches), unlike a bare `== nil` comparison.
Types ¶
type Expectation ¶
type Expectation struct {
// contains filtered or unexported fields
}
Expectation is a TestingT-bound assertion produced by Expect or Require.
func Expect ¶
func Expect(t TestingT, actual any) *Expectation
Expect begins a soft assertion: a failure is reported via Errorf and the test continues (assert-style).
func Require ¶
func Require(t TestingT, actual any) *Expectation
Require begins a hard assertion: the first failure stops the test via Fatalf (require-style).
func (*Expectation) NotTo ¶
func (e *Expectation) NotTo(matcher any, msgAndArgs ...any) bool
NotTo asserts that actual does NOT satisfy the matcher. An optional message provides failure context (see To).
func (*Expectation) To ¶
func (e *Expectation) To(matcher any, msgAndArgs ...any) bool
To asserts that actual satisfies the matcher. The matcher may be a be/gomega/ gomock matcher or a raw value (wrapped via Psi, like the rest of be). An optional message — a format string plus args, or plain values — is prepended to the failure output for context. Returns true on success.
type TestingT ¶
type TestingT interface {
Helper()
Errorf(format string, args ...any)
Fatalf(format string, args ...any)
}
TestingT is the minimal subset of *testing.T the native driver needs. *testing.T satisfies it; tests can supply a fake. Mirrors testify's approach so the runner never imports the heavyweight `testing` package contract.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package be_ctx provides Be matchers on context.Context
|
Package be_ctx provides Be matchers on context.Context |
|
Package be_http provides matchers for url.Request TODO: more detailed documentation here is required
|
Package be_http provides matchers for url.Request TODO: more detailed documentation here is required |
|
Package be_json provides Be matchers for expressive assertions on JSON TODO: more detailed explanation what is considered to be JSON here
|
Package be_json provides Be matchers for expressive assertions on JSON TODO: more detailed explanation what is considered to be JSON here |
|
Package be_jwt provides Be matchers for handling JSON Web Tokens (JWT).
|
Package be_jwt provides Be matchers for handling JSON Web Tokens (JWT). |
|
Package be_math provides Be matchers for mathematical operations
|
Package be_math provides Be matchers for mathematical operations |
|
Package be_reflected provides Be matchers that use reflection, enabling expressive assertions on values' reflect kinds and types.
|
Package be_reflected provides Be matchers that use reflection, enabling expressive assertions on values' reflect kinds and types. |
|
Package be_string provides Be matchers for string-related assertions.
|
Package be_string provides Be matchers for string-related assertions. |
|
Package be_time provides Be matchers on time.Time
|
Package be_time provides Be matchers on time.Time |
|
Package be_url provides Be matchers on url.URL
|
Package be_url provides Be matchers on url.URL |
|
internal
|
|
|
beformat
Package beformat renders matcher failure messages in a compact, framework-native form.
|
Package beformat renders matcher failure messages in a compact, framework-native form. |
|
psi
Package psi contains helpers that extends gomega library Name psi stands for previous letter from Omega (as we want to have a name that is close to gomega, but not to be a gomega)
|
Package psi contains helpers that extends gomega library Name psi stands for previous letter from Omega (as we want to have a name that is close to gomega, but not to be a gomega) |
|
psi_matchers
Package psi_matchers is a package that contains core matchers required Psi() to work properly
|
Package psi_matchers is a package that contains core matchers required Psi() to work properly |
|
testing/mocks
Code generated by MockGen.
|
Code generated by MockGen. |
|
Package options declares options to be used in customizeable matchers Note: Options of ALL `be_*` matchers are stored here, in a separate package `options`.
|
Package options declares options to be used in customizeable matchers Note: Options of ALL `be_*` matchers are stored here, in a separate package `options`. |
|
x
|
|
|
belint
module
|
|
|
mock
module
|
|
|
testify
module
|