test_utils

package
v1.10.8 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 23 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConditionLogFunctionType = sema.NewSimpleFunctionType(
	sema.FunctionPurityView,
	[]sema.Parameter{
		{
			Label:          sema.ArgumentLabelNotRequired,
			Identifier:     "value",
			TypeAnnotation: sema.AnyStructTypeAnnotation,
		},
	},
	sema.BoolTypeAnnotation,
)

Functions

func ParseCheckAndInterpret added in v1.5.0

func ParseCheckAndInterpret(t testing.TB, code string) *interpreter.Interpreter

func ParseCheckAndInterpretWithAtreeValidationsDisabled added in v1.5.0

func ParseCheckAndInterpretWithAtreeValidationsDisabled(
	t testing.TB,
	code string,
	options ParseCheckAndInterpretOptions,
) (
	inter *interpreter.Interpreter,
	err error,
)

func ParseCheckAndInterpretWithOptions added in v1.5.0

func ParseCheckAndInterpretWithOptions(
	t testing.TB,
	code string,
	options ParseCheckAndInterpretOptions,
) (
	inter *interpreter.Interpreter,
	err error,
)

func ParseCheckAndPrepare

func ParseCheckAndPrepare(tb testing.TB, code string, compile bool) Invokable

func ParseCheckAndPrepareWithAtreeValidationsDisabled added in v1.7.0

func ParseCheckAndPrepareWithAtreeValidationsDisabled(
	tb testing.TB,
	code string,
	options ParseCheckAndInterpretOptions,
	compile bool,
) (Invokable, error)

func ParseCheckAndPrepareWithEvents added in v1.5.0

func ParseCheckAndPrepareWithEvents(tb testing.TB, code string, compile bool) (
	invokable Invokable,
	getEvents func() []TestEvent,
	err error,
)

func ParseCheckAndPrepareWithLogs added in v1.7.0

func ParseCheckAndPrepareWithLogs(
	tb testing.TB,
	code string,
	compile bool,
) (
	invokable Invokable,
	getLogs func() []string,
	err error,
)

func ParseCheckAndPrepareWithOptions added in v1.5.0

func ParseCheckAndPrepareWithOptions(
	tb testing.TB,
	code string,
	options ParseCheckAndInterpretOptions,
	compile bool,
	compare bool,
) (
	invokable Invokable,
	err error,
)

func ParseCheckAndPrepareWithoutStorageComparison added in v1.9.0

func ParseCheckAndPrepareWithoutStorageComparison(tb testing.TB, code string, compile bool) Invokable

Types

type ParseCheckAndInterpretOptions

type ParseCheckAndInterpretOptions struct {
	ParseAndCheckOptions *ParseAndCheckOptions
	InterpreterConfig    *interpreter.Config
	HandleCheckerError   func(error)
	// HandleChecker is called with the checker after checking,
	// before the program is interpreted or compiled.
	// It can be used to e.g. manipulate the elaboration for tests.
	HandleChecker func(*sema.Checker)
}

type TestEvent added in v1.5.0

type TestEvent struct {
	EventType   *sema.CompositeType
	EventFields []interpreter.Value
}

type VMInvokable added in v1.7.0

type VMInvokable struct {
	*vm.Context
	// contains filtered or unexported fields
}

func NewVMInvokable added in v1.7.0

func NewVMInvokable(
	vmInstance *vm.VM,
	elaboration *compiler.DesugaredElaboration,
) *VMInvokable

func (*VMInvokable) GetGlobal added in v1.7.0

func (v *VMInvokable) GetGlobal(name string) interpreter.Value

func (*VMInvokable) GetGlobalType added in v1.7.0

func (v *VMInvokable) GetGlobalType(name string) (*sema.Variable, bool)

func (*VMInvokable) InitializeContract added in v1.7.0

func (v *VMInvokable) InitializeContract(contractName string, arguments ...interpreter.Value) (*interpreter.CompositeValue, error)

func (*VMInvokable) Invoke added in v1.7.0

func (v *VMInvokable) Invoke(
	functionName string,
	arguments ...interpreter.Value,
) (
	interpreter.Value,
	error,
)

Invoke invokes a global function with the given arguments

func (*VMInvokable) InvokeTransaction added in v1.7.0

func (v *VMInvokable) InvokeTransaction(arguments []interpreter.Value, signers ...interpreter.Value) (err error)

func (*VMInvokable) InvokeUncheckedForTestingOnly deprecated added in v1.9.7

func (v *VMInvokable) InvokeUncheckedForTestingOnly(
	functionName string,
	arguments ...interpreter.Value,
) (
	interpreter.Value,
	error,
)

Deprecated: InvokeUncheckedForTestingOnly invokes a global function with the given arguments, without validating them. NOTE: FOR TESTING PURPOSES ONLY! Use Invoke instead

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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