context

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package context provides the test context of scenarigo.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context represents a scenarigo context.

func FromT

func FromT(t *testing.T) *Context

FromT creates a new context from t.

func New

func New(r reporter.Reporter) *Context

New returns a new scenarigo context.

func (*Context) EnabledColor added in v0.3.0

func (c *Context) EnabledColor() bool

EnabledColor returns whether color output is enabled

func (*Context) ExecuteTemplate

func (ctx *Context) ExecuteTemplate(i interface{}) (interface{}, error)

ExecuteTemplate executes template strings in context. nolint:stylecheck

func (*Context) ExtractByKey

func (c *Context) ExtractByKey(key string) (interface{}, bool)

ExtractByKey implements query.KeyExtractor interface.

func (*Context) Node added in v0.3.0

func (c *Context) Node() ast.Node

Node returns the ast.Node.

func (*Context) PluginDir

func (c *Context) PluginDir() string

PluginDir returns the plugins root directory.

func (*Context) Plugins

func (c *Context) Plugins() Plugins

Plugins returns the plugins.

func (*Context) Reporter

func (c *Context) Reporter() reporter.Reporter

Reporter returns the reporter of context.

func (*Context) Request

func (c *Context) Request() interface{}

Request returns the request.

func (*Context) RequestContext

func (c *Context) RequestContext() context.Context

RequestContext returns the context.Context for request.

func (*Context) Response

func (c *Context) Response() interface{}

Response returns the response.

func (*Context) Run

func (c *Context) Run(name string, f func(*Context)) bool

Run runs f as a subtest of c called name.

func (*Context) Vars

func (c *Context) Vars() Vars

Vars returns the context variables.

func (*Context) WithEnabledColor added in v0.3.0

func (c *Context) WithEnabledColor(enabledColor bool) *Context

WithEnabledColor returns a copy of c with enabledColor flag

func (*Context) WithNode added in v0.3.0

func (c *Context) WithNode(node ast.Node) *Context

WithNode returns a copy of c with ast.Node

func (*Context) WithPluginDir

func (c *Context) WithPluginDir(path string) *Context

WithPluginDir returns a copy of c with plugin root directory.

func (*Context) WithPlugins

func (c *Context) WithPlugins(ps map[string]interface{}) *Context

WithPlugins returns a copy of c with ps.

func (*Context) WithReporter

func (c *Context) WithReporter(r reporter.Reporter) *Context

WithReporter returns a copy of c with new test reporter.

func (*Context) WithRequest

func (c *Context) WithRequest(req interface{}) *Context

WithRequest returns a copy of c with request.

func (*Context) WithRequestContext

func (c *Context) WithRequestContext(reqCtx context.Context) *Context

WithRequestContext returns the context.Context for request.

func (*Context) WithResponse

func (c *Context) WithResponse(resp interface{}) *Context

WithResponse returns a copy of c with response.

func (*Context) WithVars

func (c *Context) WithVars(v interface{}) *Context

WithVars returns a copy of c with v.

type Plugins

type Plugins []map[string]interface{}

Plugins represents plugins.

func (Plugins) Append

func (plugins Plugins) Append(ps map[string]interface{}) Plugins

Append appends p to plugins.

func (Plugins) ExtractByKey

func (plugins Plugins) ExtractByKey(key string) (interface{}, bool)

ExtractByKey implements query.KeyExtractor interface.

type Vars

type Vars []interface{}

Vars represents context variables.

func (Vars) Append

func (vars Vars) Append(v interface{}) Vars

Append appends v to context variables.

func (Vars) ExtractByKey

func (vars Vars) ExtractByKey(key string) (interface{}, bool)

ExtractByKey implements query.KeyExtractor interface.

Jump to

Keyboard shortcuts

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