testutil

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Char

func Char(ch rune) command.KeyEvent

Char builds a KeyEvent for a printable character

func CursorPos

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

CursorPos returns the cursor position in the focused document

func EditorWithText

func EditorWithText(t *testing.T, text string) *view.Editor

EditorWithText creates an editor seeded with text and the cursor at pos 0

func GitCommitFile

func GitCommitFile(t *testing.T, repo, name, content string) string

GitCommitFile writes and commits a file, returning its absolute path

func GitRepo

func GitRepo(t *testing.T) string

GitRepo creates a temporary git repository with commit identity configured

func RegisteredValue

func RegisteredValue(t *testing.T, e *view.Editor, reg rune) string

RegisteredValue returns the first value stored in the named register

func RequireGit

func RequireGit(t *testing.T)

RequireGit skips the test when no git binary is on PATH

func RunGit

func RunGit(t *testing.T, dir string, args ...string)

func SetCursor

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

SetCursor moves the focused view's cursor to pos

func SetEditorText

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

SetEditorText inserts text into an existing editor's focused document

func SetSelection

func SetSelection(
	t *testing.T, e *view.Editor, ranges []core.Range, primary int,
)

SetSelection replaces the focused view's selection

func Special

func Special(s command.Special) command.KeyEvent

Special builds a KeyEvent for a special key

func WriteFile

func WriteFile(t *testing.T, path, content string)

Types

type FakeClipboard

type FakeClipboard struct {
	System  string
	Primary string
	Ready   bool
}

FakeClipboard is an in-memory view.Clipboard for hermetic tests, keeping the system and PRIMARY selections in separate buffers

func NewFakeClipboard

func NewFakeClipboard() *FakeClipboard

func (*FakeClipboard) Available

func (c *FakeClipboard) Available() bool

func (*FakeClipboard) Read

func (c *FakeClipboard) Read() (string, error)

func (*FakeClipboard) ReadPrimary

func (c *FakeClipboard) ReadPrimary() (string, error)

func (*FakeClipboard) Write

func (c *FakeClipboard) Write(text string) error

func (*FakeClipboard) WritePrimary

func (c *FakeClipboard) WritePrimary(text string) error

Jump to

Keyboard shortcuts

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