tests

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: UNKNOWN not legal advice Imports: 0 Imported by: 0

README

All the files in the ./files directory are meant to be those derived/borrowed from Yaegi, Apache2.0.

Documentation

Index

Constants

View Source
const (
	// use stdlibs/* only (except a few exceptions). for stdlibs/* and examples/* testing.
	ImportModeStdlibsOnly importMode = iota
	// use stdlibs/* if present, otherwise use native. used in files/tests, excluded for *_native.go
	ImportModeStdlibsPreferred
	// do not use stdlibs/* if native registered. used in files/tests, excluded for *_stdlibs.go
	ImportModeNativePreferred
)

Import modes to control the import behaviour of TestStore.

Variables

This section is empty.

Functions

func CleanupMachine

func CleanupMachine(m *gno.Machine)

CleanupMachine can be called during two tests while reusing the same Machine instance.

func DefaultPkgName

func DefaultPkgName(gopkgPath string) gno.Name

func RunFileTest

func RunFileTest(rootDir string, path string, opts ...RunFileTestOption) error

RunFileTest executes the filetest at the given path, using rootDir as the directory where to find the "stdlibs" directory.

func TestContext

func TestContext(pkgPath string, send std.Coins) *teststd.TestExecContext

TestContext returns a TestExecContext. Usable for test purpose only.

func TestMachine

func TestMachine(store gno.Store, stdout io.Writer, pkgPath string) *gno.Machine

func TestStore

func TestStore(rootDir, filesPath string, stdin io.Reader, stdout, stderr io.Writer, mode importMode) (resStore gno.Store)

NOTE: this isn't safe, should only be used for testing.

Types

type RunFileTestOption

type RunFileTestOption func(*runFileTestOptions)

RunFileTestOptions specify changing options in RunFileTest, deviating from the zero value.

func WithLoggerFunc

func WithLoggerFunc(f func(args ...interface{})) RunFileTestOption

WithLoggerFunc sets a logging function for RunFileTest.

func WithNativeLibs

func WithNativeLibs() RunFileTestOption

WithNativeLibs enables using go native libraries (ie, ImportModeNativePreferred) instead of using stdlibs/*.

func WithSyncWanted

func WithSyncWanted(v bool) RunFileTestOption

WithSyncWanted sets the syncWanted flag to true. It rewrites tests files so that the values of Output: and of Realm: comments match the actual output or realm state after the test.

type TestReport

type TestReport struct {
	Name    string
	Verbose bool
	Failed  bool
	Skipped bool
	Output  string
}

Directories

Path Synopsis
std

Jump to

Keyboard shortcuts

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