test

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package test is the shared black-box test harness for the default command modules: it builds an editor with all defaults registered and runs commands resolved from the keymaps, so each module's tests can live beside the module while exercising the fully assembled registry

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Char

func Char(ch rune) command.KeyEvent

Char is a bare key event for a rune, for feeding continuations

func CursorLine

func CursorLine(t *testing.T, e *view.Editor) int

CursorLine returns the focused document's primary cursor line

func DocText

func DocText(t *testing.T, e *view.Editor) string

DocText returns the focused document's full text

func Env

func Env(t *testing.T, text string) (*view.Editor, *command.Keymaps)

Env builds an editor with all default commands registered, seeded with text. Commands resolved from the keymaps operate on the returned editor

func EnvWithRegistry

func EnvWithRegistry(t *testing.T, text string) (
	*view.Editor, *command.Keymaps, *command.Registry,
)

EnvWithRegistry builds the same env as Env but also returns the registry so tests can call ApplyTOML to exercise section Apply funcs

func MustFocusedView

func MustFocusedView(t *testing.T, e *view.Editor) *view.View

MustFocusedView returns the focused view, failing the test if there is none

func RunCmd

func RunCmd(
	t *testing.T, km *command.Keymaps, e *view.Editor, name string,
) command.Result

RunCmd resolves a command by name and runs it against the editor. The default command wrappers ignore the Args, so nil is passed

func RunCmdArgs

func RunCmdArgs(
	t *testing.T, km *command.Keymaps, e *view.Editor, name, input string,
) command.Result

RunCmdArgs resolves a command and runs it with positional args parsed from input against the command's own signature

func Special

func Special(s command.Special) command.KeyEvent

Special is a bare key event for a special key

func TwoBufferEnv

func TwoBufferEnv(t *testing.T) (*view.Editor, *command.Keymaps)

TwoBufferEnv opens two files so buffer commands have multiple views to act on

Types

This section is empty.

Jump to

Keyboard shortcuts

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