runner

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dedent

func Dedent(s string) string

Dedent removes the common leading whitespace from all lines in a string. Empty lines (or lines with only whitespace) are ignored when calculating the common indent, but are preserved in the output (as empty lines).

func GetReporter

func GetReporter(ctx context.Context) reporter.Reporter

func Info

func Info(ctx context.Context, info reporter.Info)

Info logs information about test execution if a reporter is available. It automatically applies Dedent to the Content field and all Args values to remove common leading whitespace from multi-line strings.

func SetCheckError

func SetCheckError(ctx context.Context, err *CheckError) context.Context

SetCheckError stores a CheckError in the context for later retrieval

func StdCheck

func StdCheck(L *lua.LState, tbl *lua.LTable, b any)

func StdCheckDefinition

func StdCheckDefinition(fn lua.LGFunction) *spec.Function

func StdCheckError

func StdCheckError(ctx context.Context, tbl *lua.LTable, b any) error

func WithReporter

func WithReporter(ctx context.Context, r reporter.Reporter) context.Context

func WithSaveFunc

func WithSaveFunc(ctx context.Context, fn SaveFunc) context.Context

Types

type CheckError

type CheckError struct {
	Diff     string
	Expected any
	Actual   any
}

CheckError is a structured error type that holds the diff message along with the original expected and actual values for copying.

func GetCheckError

func GetCheckError(ctx context.Context) (*CheckError, bool)

GetCheckError retrieves the CheckError from the context if present

func (*CheckError) Error

func (e *CheckError) Error() string

type GQL

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

func NewGQLRunner

func NewGQLRunner(server http.Handler) *GQL

func (*GQL) AfterTest

func (g *GQL) AfterTest(ctx context.Context)

func (*GQL) Functions

func (g *GQL) Functions() []*spec.Function

func (*GQL) Name

func (g *GQL) Name() string

type PubSub

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

func NewPubSub

func NewPubSub(doPublish PubSubHook) *PubSub

func (*PubSub) Functions

func (g *PubSub) Functions() []*spec.Function

func (*PubSub) HelperFunctions

func (g *PubSub) HelperFunctions() []*spec.Function

func (*PubSub) Name

func (p *PubSub) Name() string

func (*PubSub) Receive

func (p *PubSub) Receive(topic string, msg PubSubMessage)

func (*PubSub) Send

func (p *PubSub) Send(topic string, msg PubSubMessage)

type PubSubHook

type PubSubHook func(topic string, msg PubSubMessage) error

type PubSubMessage

type PubSubMessage struct {
	Msg        map[string]any    `json:"msg"`
	Attributes map[string]string `json:"attributes"`
}

type PubSubTopic

type PubSubTopic struct {
	Sent     []PubSubMessage
	Received []PubSubMessage
}

type REST

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

func NewRestRunner

func NewRestRunner(server http.Handler) *REST

func (*REST) Functions

func (s *REST) Functions() []*spec.Function

func (*REST) Name

func (r *REST) Name() string

type Reporter

type Reporter interface {
	Error(msg string, args ...any)
}

type SQL

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

func NewSQLRunner

func NewSQLRunner(db *pgxpool.Pool) *SQL

func (*SQL) Functions

func (s *SQL) Functions() []*spec.Function

func (*SQL) HelperFunctions

func (s *SQL) HelperFunctions() []*spec.Function

func (*SQL) Name

func (s *SQL) Name() string

type SaveFunc

type SaveFunc func(key string, value any)

Jump to

Keyboard shortcuts

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