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 the slice. 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) bool
NotTo asserts that actual does NOT satisfy the matcher.
func (*Expectation) To ΒΆ
func (e *Expectation) To(matcher 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). It returns true on success.
func (*Expectation) ToNot ΒΆ
func (e *Expectation) ToNot(matcher any) bool
ToNot is an alias for NotTo.
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
|