assertmodule

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Fail = starlark.NewBuiltin("fail", failImpl)

Functions

This section is empty.

Types

type TestContext

type TestContext struct {
	Attrs    starlark.StringDict
	Failures []error
}

TestContext is keeps track of whether there is a failure during a test execution

func AssertModule

func AssertModule() *TestContext

AssertModule contains assertion functions. The *TestContext returned can be used to track assertion failures. assert.* functions from this module will mutate the *TestContext. After execution is complete, TestContext.Failures will be non-empty if any of the assertions failed, and also contain details about the failures.

func (*TestContext) AssertBinaryImpl

func (t *TestContext) AssertBinaryImpl(op syntax.Token) func(thread *starlark.Thread, fn *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

AssertBinaryImpl returns a function that implements comparing binary values in an assertion (i.e. assert_eq(1, 2))

func (*TestContext) AssertFails

func (t *TestContext) AssertFails(thread *starlark.Thread, fn *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

func (*TestContext) Attr

func (t *TestContext) Attr(name string) (starlark.Value, error)

func (*TestContext) AttrNames

func (t *TestContext) AttrNames() []string

func (*TestContext) CallInternal

func (t *TestContext) CallInternal(thread *starlark.Thread, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

CallInternal is the implementation for assert(...)

func (*TestContext) Freeze

func (t *TestContext) Freeze()

func (*TestContext) Hash

func (t *TestContext) Hash() (uint32, error)

func (*TestContext) Name

func (t *TestContext) Name() string

func (*TestContext) String

func (t *TestContext) String() string

func (*TestContext) Truth

func (t *TestContext) Truth() starlark.Bool

func (*TestContext) Type

func (t *TestContext) Type() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL