debug

package
v0.24.8 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2024 License: BSD-3-Clause Imports: 13 Imported by: 1

Documentation

Overview

Scripting commands to debug and test stories.

Index

Constants

This section is empty.

Variables

View Source
var Stepper func(words string) error

a callback so fabricate can trigger a step of the parser; fabricate will error if this is nil/unset. ( see also: cmdcheck )

View Source
var Z_Types = typeinfo.TypeSet{
	Name: "debug",
	Comment: []string{
		"Scripting commands to debug and test stories.",
	},

	Flow:       z_flow_list,
	Str:        z_str_list,
	Signatures: z_signatures,
}

package listing of type data

View Source
var Zt_DoNothing typeinfo.Flow

do_nothing, a type of flow.

View Source
var Zt_Expect typeinfo.Flow

expect, a type of flow.

View Source
var Zt_ExpectText typeinfo.Flow

expect_text, a type of flow.

View Source
var Zt_Fabricate typeinfo.Flow

fabricate, a type of flow.

View Source
var Zt_LogValue typeinfo.Flow

log_value, a type of flow.

View Source
var Zt_LoggingLevel = typeinfo.Str{
	Name: "logging_level",
	Options: []string{
		"debug",
		"info",
		"warn",
		"error",
	},
	Markup: map[string]any{
		"--": "Used with [DebugLog].",
	},
}

logging_level, a type of str enum.

View Source
var Zt_Note typeinfo.Flow

note, a type of flow.

Functions

func Register added in v0.24.7

func Register(reg func(any))

gob like registration

func SplitLines

func SplitLines(str string) []string

separate a string into separate lines whenever a linefeed ( \n ) is detected.

func Stringify

func Stringify(v rt.Value) (ret string)

turn a tapestry generic value into a json(ish) formatted string

Types

type DoNothing

type DoNothing struct {
	Markup map[string]any `json:",omitempty"`
}

A runtime command that does... nothing. ( Can be used to fill in branches ( ex. of if statements )

or rules which aren't supposed to do anything. )

func (DoNothing) Execute

func (DoNothing) Execute(rt.Runtime) error

func (*DoNothing) GetMarkup

func (op *DoNothing) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*DoNothing) TypeInfo

func (*DoNothing) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type DoNothingText added in v0.24.6

type DoNothingText string

type DoNothing_Slice

type DoNothing_Slice []DoNothing

Holds a slice of type DoNothing.

func (*DoNothing_Slice) Repeats

func (op *DoNothing_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of DoNothing.

func (*DoNothing_Slice) TypeInfo

func (*DoNothing_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of DoNothing.

type Expect

type Expect struct {
	Label  string
	Value  rtti.BoolEval
	Markup map[string]any `json:",omitempty"`
}

Evaluate a boolean command and ensure it returns true.

func (*Expect) Execute

func (op *Expect) Execute(run rt.Runtime) (err error)

func (*Expect) GetMarkup

func (op *Expect) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*Expect) TypeInfo

func (*Expect) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type ExpectText

type ExpectText struct {
	Text   rtti.TextEval
	Markup map[string]any `json:",omitempty"`
}

Examine the most recent game output, and generate an error unless it matches the specified text.

func (*ExpectText) Execute

func (op *ExpectText) Execute(run rt.Runtime) (err error)

func (*ExpectText) GetMarkup

func (op *ExpectText) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*ExpectText) TypeInfo

func (*ExpectText) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type ExpectText_Slice

type ExpectText_Slice []ExpectText

Holds a slice of type ExpectText.

func (*ExpectText_Slice) Repeats

func (op *ExpectText_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of ExpectText.

func (*ExpectText_Slice) TypeInfo

func (*ExpectText_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of ExpectText.

type Expect_Slice

type Expect_Slice []Expect

Holds a slice of type Expect.

func (*Expect_Slice) Repeats

func (op *Expect_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of Expect.

func (*Expect_Slice) TypeInfo

func (*Expect_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of Expect.

type Fabricate

type Fabricate struct {
	Text   rtti.TextEval
	Markup map[string]any `json:",omitempty"`
}

Process fake input as if the player had typed it themselves. Fabricate only works while running tests, and does nothing during normal game play. Multiple actions can be specified by separating them with semi-colons. For example:

Fabricate input: "s; jump; look"

func (*Fabricate) Execute

func (op *Fabricate) Execute(run rt.Runtime) (err error)

func (*Fabricate) GetMarkup

func (op *Fabricate) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*Fabricate) TypeInfo

func (*Fabricate) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type Fabricate_Slice

type Fabricate_Slice []Fabricate

Holds a slice of type Fabricate.

func (*Fabricate_Slice) Repeats

func (op *Fabricate_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of Fabricate.

func (*Fabricate_Slice) TypeInfo

func (*Fabricate_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of Fabricate.

type GreatExpectations

type GreatExpectations interface {
	// gets and resets the most recent game output
	GetAccumulatedOutput() []string
}

an optional interface runtimes can implement for testing

type LogValue added in v0.24.6

type LogValue struct {
	LogLevel LoggingLevel
	Value    rtti.Assignment
	Markup   map[string]any `json:",omitempty"`
}

Print a value that might be useful during development. It will be hidden from players in the final game.

func (*LogValue) Execute added in v0.24.6

func (op *LogValue) Execute(run rt.Runtime) (err error)

func (*LogValue) GetMarkup added in v0.24.6

func (op *LogValue) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*LogValue) TypeInfo added in v0.24.6

func (*LogValue) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type LogValue_Slice added in v0.24.6

type LogValue_Slice []LogValue

Holds a slice of type LogValue.

func (*LogValue_Slice) Repeats added in v0.24.6

func (op *LogValue_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of LogValue.

func (*LogValue_Slice) TypeInfo added in v0.24.6

func (*LogValue_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of LogValue.

type LoggingLevel

type LoggingLevel int

LoggingLevel, a type of str enum.

const (
	C_LoggingLevel_Debug LoggingLevel = iota
	C_LoggingLevel_Info
	C_LoggingLevel_Warn
	C_LoggingLevel_Error
)

The enumerated values of LoggingLevel.

LogLevel controls how much debugging to print logs only at the named level and higher.

func MakeLoggingLevel

func MakeLoggingLevel(str string) (ret LoggingLevel, okay bool)

func (LoggingLevel) String

func (op LoggingLevel) String() (ret string)

type Note added in v0.24.6

type Note struct {
	Text     rtti.TextEval
	LogLevel LoggingLevel
	Markup   map[string]any `json:",omitempty"`
}

Print a message that might be useful during development. It will be hidden from players in the final game.

func (*Note) Execute added in v0.24.6

func (op *Note) Execute(run rt.Runtime) (err error)

func (*Note) GetMarkup added in v0.24.6

func (op *Note) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*Note) TypeInfo added in v0.24.6

func (*Note) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type Note_Slice added in v0.24.6

type Note_Slice []Note

Holds a slice of type Note.

func (*Note_Slice) Repeats added in v0.24.6

func (op *Note_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of Note.

func (*Note_Slice) TypeInfo added in v0.24.6

func (*Note_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of Note.

Jump to

Keyboard shortcuts

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