Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 1.07 KB

README.md

File metadata and controls

41 lines (31 loc) · 1.07 KB

be_ctx

-- import "github.com/expectto/be/be_ctx"

Package be_ctx provides Be matchers on context.Context

Usage

func Ctx

func Ctx(args ...any) types.BeMatcher

Ctx succeeds if the actual value is a context.Context. If no arguments are provided, it matches any context.Context. Otherwise, it uses the Psi matcher to match the provided arguments against the actual context's values.

func CtxWithDeadline

func CtxWithDeadline(deadline any) types.BeMatcher

CtxWithDeadline succeeds if the actual value is a context.Context and its deadline matches the provided deadline.

func CtxWithError

func CtxWithError(err any) types.BeMatcher

CtxWithError succeeds if the actual value is a context.Context and its error matches the provided error value.

func CtxWithValue

func CtxWithValue(key any, vs ...any) types.BeMatcher

CtxWithValue succeeds if the actual value is a context.Context and contains a key-value pair where the key matches the provided key and the value matches the provided arguments using any other matchers.