Documentation ¶
Index ¶
- func PrettyPrintResult(funcName string, err error) string
- func PrettyPrintResults(results Results) string
- type EmulatorBackend
- func (e *EmulatorBackend) AddTransaction(code string, authorizers []common.Address, signers []*stdlib.Account, ...) error
- func (e *EmulatorBackend) CommitBlock() error
- func (e EmulatorBackend) CreateAccount() (*stdlib.Account, error)
- func (e *EmulatorBackend) DeployContract(name string, code string, account *stdlib.Account, args []interpreter.Value) error
- func (e *EmulatorBackend) ExecuteNextTransaction() *stdlib.TransactionResult
- func (e *EmulatorBackend) ReadFile(path string) (string, error)
- func (e *EmulatorBackend) RunScript(code string, args []interpreter.Value) *stdlib.ScriptResult
- func (e *EmulatorBackend) UseConfiguration(configuration *stdlib.Configuration)
- type FileResolver
- type FileResolverNotProvidedError
- type ImportResolver
- type ImportResolverNotProvidedError
- type Result
- type Results
- type TestRunner
- func (r *TestRunner) RunTest(script string, funcName string) (result *Result, err error)
- func (r *TestRunner) RunTests(script string) (results Results, err error)
- func (r *TestRunner) WithFileResolver(fileResolver FileResolver) *TestRunner
- func (r *TestRunner) WithImportResolver(importResolver ImportResolver) *TestRunner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrettyPrintResult ¶
func PrettyPrintResults ¶
PrettyPrintResults is a utility function to pretty print the test results.
Types ¶
type EmulatorBackend ¶
type EmulatorBackend struct {
// contains filtered or unexported fields
}
EmulatorBackend is the emulator-backed implementation of the interpreter.TestFramework.
func NewEmulatorBackend ¶
func NewEmulatorBackend(fileResolver FileResolver) *EmulatorBackend
func (*EmulatorBackend) AddTransaction ¶
func (e *EmulatorBackend) AddTransaction( code string, authorizers []common.Address, signers []*stdlib.Account, args []interpreter.Value, ) error
func (*EmulatorBackend) CommitBlock ¶
func (e *EmulatorBackend) CommitBlock() error
func (EmulatorBackend) CreateAccount ¶
func (e EmulatorBackend) CreateAccount() (*stdlib.Account, error)
func (*EmulatorBackend) DeployContract ¶
func (e *EmulatorBackend) DeployContract( name string, code string, account *stdlib.Account, args []interpreter.Value, ) error
func (*EmulatorBackend) ExecuteNextTransaction ¶
func (e *EmulatorBackend) ExecuteNextTransaction() *stdlib.TransactionResult
func (*EmulatorBackend) RunScript ¶
func (e *EmulatorBackend) RunScript(code string, args []interpreter.Value) *stdlib.ScriptResult
func (*EmulatorBackend) UseConfiguration ¶
func (e *EmulatorBackend) UseConfiguration(configuration *stdlib.Configuration)
type FileResolver ¶
FileResolver is used to resolve and get local files. Returns the content of the file as a string. Must be provided by the user of the TestRunner.
type FileResolverNotProvidedError ¶
type FileResolverNotProvidedError struct {
Err error
}
FileResolverNotProvidedError is thrown if the file resolver is not set in the TestRunner, when running tests.
func (FileResolverNotProvidedError) Error ¶
func (e FileResolverNotProvidedError) Error() string
func (FileResolverNotProvidedError) Unwrap ¶
func (e FileResolverNotProvidedError) Unwrap() error
type ImportResolver ¶
ImportResolver is used to resolve and get the source code for imports. Must be provided by the user of the TestRunner.
type ImportResolverNotProvidedError ¶
type ImportResolverNotProvidedError struct {
Err error
}
ImportResolverNotProvidedError is thrown if the import resolver is not set in the TestRunner, when running tests.
func (ImportResolverNotProvidedError) Error ¶
func (e ImportResolverNotProvidedError) Error() string
func (ImportResolverNotProvidedError) Unwrap ¶
func (e ImportResolverNotProvidedError) Unwrap() error
type TestRunner ¶
type TestRunner struct {
// contains filtered or unexported fields
}
TestRunner runs tests.
func NewTestRunner ¶
func NewTestRunner() *TestRunner
func (*TestRunner) RunTest ¶
func (r *TestRunner) RunTest(script string, funcName string) (result *Result, err error)
RunTest runs a single test in the provided test script.
func (*TestRunner) RunTests ¶
func (r *TestRunner) RunTests(script string) (results Results, err error)
RunTests runs all the tests in the provided test script.
func (*TestRunner) WithFileResolver ¶
func (r *TestRunner) WithFileResolver(fileResolver FileResolver) *TestRunner
func (*TestRunner) WithImportResolver ¶
func (r *TestRunner) WithImportResolver(importResolver ImportResolver) *TestRunner