Documentation ¶
Overview ¶
Package assert contains a system-specific wrapper for testify assertions
Index ¶
- Constants
- func GetRootSymbol(e encoder.Encoder, n data.Local) data.Value
- func GetTestEncoder() encoder.Encoder
- func GetTestEnvironment() *env.Environment
- func GetTestNamespace() env.Namespace
- type Wrapper
- func (w *Wrapper) Compare(c data.Comparison, l data.Number, r data.Number)
- func (w *Wrapper) Contains(expect string, expr data.Value)
- func (w *Wrapper) EncodesAs(expected isa.Instructions, src data.String)
- func (w *Wrapper) Equal(expect any, expr any)
- func (w *Wrapper) Eval(src string) data.Value
- func (w *Wrapper) EvalTo(src string, expect data.Value)
- func (w *Wrapper) ExpectNoPanic()
- func (w *Wrapper) ExpectPanic(err any)
- func (w *Wrapper) ExpectProgrammerError(errStr string)
- func (w *Wrapper) False(expr any)
- func (w *Wrapper) Identical(expect any, expr any)
- func (w *Wrapper) Instructions(expected, actual isa.Instructions)
- func (w *Wrapper) MustGet(m data.Mapped, k data.Value) data.Value
- func (w *Wrapper) NotContains(expect string, expr data.Value)
- func (w *Wrapper) NotIdentical(expect any, expr any)
- func (w *Wrapper) Number(expect float64, expr any)
- func (w *Wrapper) PanicWith(src string, err any)
- func (w *Wrapper) String(expect string, expr any)
- func (w *Wrapper) True(expr any)
Constants ¶
const ( // ErrInvalidTestExpression is raised when a check encounters a test value // that is not expected ErrInvalidTestExpression = "invalid test expression: %v" // ErrProperErrorNotRaised is raised when a panic is expected but not seen ErrProperErrorNotRaised = "proper error not raised" // ErrCannotMakeString is raised when a value can't be made into a string ErrCannotMakeString = "can't convert value to string" // ErrValueNotFound is raised when a forced retrieval from an Object fails ErrValueNotFound = "value not found in object: %s" )
Variables ¶
This section is empty.
Functions ¶
func GetRootSymbol ¶
GetRootSymbol is a test helper that retrieves the value for a named symbol from the Encoder's global environment or dies trying
func GetTestEncoder ¶
GetTestEncoder returns a new Encoder, rooted at a test Namespace
func GetTestEnvironment ¶
func GetTestEnvironment() *env.Environment
GetTestEnvironment returns an immutable root testing Environment
func GetTestNamespace ¶
GetTestNamespace returns a new anonymous namespace for testing purposes
Types ¶
type Wrapper ¶
type Wrapper struct { *testing.T *assert.Assertions }
Wrapper wraps testify assertions to perform checking and conversion that is system-specific
func (*Wrapper) EncodesAs ¶
func (w *Wrapper) EncodesAs(expected isa.Instructions, src data.String)
EncodesAs tests that a string generates the expected set of Instructions
func (*Wrapper) ExpectNoPanic ¶
func (w *Wrapper) ExpectNoPanic()
ExpectNoPanic is used with defer to make sure no error occurs
func (*Wrapper) ExpectPanic ¶
ExpectPanic is used with a defer to make sure an error was triggered
func (*Wrapper) ExpectProgrammerError ¶
ExpectProgrammerError is used with defer to make sure a programmer error was triggered
func (*Wrapper) Instructions ¶
func (w *Wrapper) Instructions(expected, actual isa.Instructions)
Instructions test that two sets of Instructions are identical
func (*Wrapper) NotContains ¶
NotContains checks if the expected string is not in the provided Value
func (*Wrapper) NotIdentical ¶
NotIdentical tests that two values are not referentially identical