testdriver

package
v0.0.35 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Overview

Package testdriver is a support package for plugins written using github.com/govim/govim

Index

Constants

View Source
const (
	KeyErrLog = "errLog"
)

Variables

View Source
var (
	DefaultErrLogMatchWait string
)

Functions

func Condition

func Condition(cond string) (bool, error)

Condition reports whether the given condition cond is satisfied or not. This function is called after the builtin testscript conditions which are documented in the testscript package, examples include:

[short] [go1.14]

Example conditions:

golang.org/issues/1234 Satisfied if GOVIM_TESTSCRIPT_ISSUES does not contain a regexp that matches the condition string

github.com/govim/govim/issues/4321 Satisfied if GOVIM_TESTSCRIPT_ISSUES does not contain a regexp that matches the condition string

[vim] Satisfied if we are testing with vim

[gvim] Satisfied if we are testing with gvim

[v1.2.3] Satisfied if we are running vim/gvim/whatever version >=v1.2.3

func EnvSubst added in v0.0.32

func EnvSubst(ts *testscript.TestScript, neg bool, args []string)

EnvSubst expands environment variable references in a file with the value of the current testscript environment.

func ErrLogMatch

func ErrLogMatch(ts *testscript.TestScript, neg bool, args []string)

func Sleep

func Sleep(ts *testscript.TestScript, neg bool, args []string)

Sleep is a convenience function for those odd occasions when you need to drop in a sleep, e.g. waiting for CursorHold to trigger

func Vim

func Vim() (exitCode int)

Vim is a sidecar that effectively drives Vim via a simple JSON-based API

func VimExprWait added in v0.0.27

func VimExprWait() (exitCode int)

Types

type Config

type Config struct {
	Name           string
	GovimPath      string
	TestHomePath   string
	TestPluginPath string
	Vim            *VimConfig
	Debug
	ReadLog *LockingBuffer
	Log     io.Writer
	*testscript.Env
	Plugin govim.Plugin
}

type Debug

type Debug struct {
	Enabled      bool
	VimLogLevel  int
	VimLogPath   string
	GovimLogPath string
}

type LockingBuffer

type LockingBuffer struct {
	NextSearchInx int
	// contains filtered or unexported fields
}

func (*LockingBuffer) Bytes

func (l *LockingBuffer) Bytes() []byte

func (*LockingBuffer) Write

func (l *LockingBuffer) Write(p []byte) (n int, err error)

type TestDriver

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

func NewTestDriver

func NewTestDriver(c *Config) (*TestDriver, error)

func (*TestDriver) Close

func (d *TestDriver) Close()

func (*TestDriver) LogStripANSI

func (d *TestDriver) LogStripANSI(r io.Reader)

func (*TestDriver) Logf

func (d *TestDriver) Logf(format string, a ...interface{})

func (*TestDriver) Run

func (d *TestDriver) Run() error

func (*TestDriver) Wait

func (d *TestDriver) Wait() error

type VimConfig added in v0.0.30

type VimConfig struct {
	InitialFile  string `json:",omitempty"`
	WindowHeight int    `json:",omitempty"`
	StartDir     string `json:",omitempty"`
}

Jump to

Keyboard shortcuts

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