Documentation
¶
Overview ¶
Package assert provides testing utilities
Index ¶
- Constants
- func GetRootSymbol(e encoder.Encoder, n data.Local) ale.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 ale.Value)
- func (w *Wrapper) Equal(expect any, expr any)
- func (w *Wrapper) ErrorWith(src string, err any)
- func (w *Wrapper) Eval(src string) (ale.Value, error)
- func (w *Wrapper) ExpectError(expected, 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) IsBound(ns env.Namespace, n data.Local) ale.Value
- func (w *Wrapper) IsNotBound(ns env.Namespace, n data.Local)
- func (w *Wrapper) IsNotDeclared(ns env.Namespace, n data.Local)
- func (w *Wrapper) MustEncodedAs(expected isa.Instructions, src data.String)
- func (w *Wrapper) MustEval(src string) ale.Value
- func (w *Wrapper) MustEvalTo(src string, expect ale.Value)
- func (w *Wrapper) MustGet(m data.Mapped, k ale.Value) ale.Value
- func (w *Wrapper) NotContains(expect string, expr ale.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, expected: %s" // ErrCannotMakeString is raised when a value can't be made into a string ErrCannotMakeString = "can't convert value to string" // ErrValueNotFound is raised when 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) ExpectError ¶ added in v0.3.0
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) IsNotBound ¶ added in v0.3.0
func (*Wrapper) IsNotDeclared ¶ added in v0.3.0
func (*Wrapper) MustEncodedAs ¶ added in v0.3.0
func (w *Wrapper) MustEncodedAs(expected isa.Instructions, src data.String)
MustEncodedAs tests that a string generates the expected set of Instructions
func (*Wrapper) MustEval ¶ added in v0.3.0
MustEval will evaluate source code on behalf of the test framework
func (*Wrapper) MustEvalTo ¶ added in v0.3.0
MustEvalTo will evaluate source code and test for an expected result
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