hostconformance

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package hostconformance contains one application scenario shared by the terminal, browser, and window host conformance tests. Hosts provide only event delivery, settling, alert answers, and lifecycle observation.

Index

Constants

View Source
const ClipboardText = "host conformance clipboard"

Variables

This section is empty.

Functions

func New

func New() (flatte.App[State], *State, *Observer)

New returns the app and observer used by every host adapter. The scenario records Init/Resize ordering, one async fold, Alert and Exec answers, clipboard round-tripping, Ctrl+C delivery, Quit, and OnExit.

func Verify

func Verify(adapter Adapter, want Expectations) error

Verify runs the same lifecycle, async, dialog, effect, clipboard, Quit, and Ctrl+C cases against an adapter. It returns a concrete failure message so tests in the root and nested window modules can share this suite.

func WaitUntil

func WaitUntil(timeout time.Duration, ready func() bool) error

WaitUntil is a utility for adapters that poll a host seam without a testing.T dependency.

Types

type Adapter

type Adapter interface {
	Start(flatte.App[State], *State, *Observer) (Driver, error)
}

Adapter starts the common app through one host's existing test seam.

type Driver

type Driver interface {
	Send(flatte.KeyEvent) error
	AnswerAlert(button int) error
	Wait(func(Snapshot) bool) error
	Finished() bool
	ClipboardWriteObserved() bool
	Close()
}

Driver is the small surface a host adapter needs to expose to the shared conformance checks. Wait must keep driving queued host work while waiting.

type Expectations

type Expectations struct {
	Capabilities   flatte.Capabilities
	AlertButton    int
	AlertError     string
	ExecError      string
	ClipboardRead  bool
	ClipboardValue string
	CtrlCDelivered bool
	CtrlCExitsRun  bool
}

Expectations captures deliberate host differences. Capabilities must be identical in Effects and RenderContext for each host.

type Observer

type Observer struct {
	OnExit func()
	// contains filtered or unexported fields
}

Observer captures the RenderContext capabilities and allows executable browser smokes to mark OnExit in the DOM shim.

func (*Observer) RenderCapabilities

func (o *Observer) RenderCapabilities() (flatte.Capabilities, bool)

RenderCapabilities returns the capabilities seen by View, once rendered.

type Snapshot

type Snapshot struct {
	Order         []string
	Keys          []string
	Initialized   bool
	Async         bool
	Width, Height int
	AlertDone     bool
	AlertButton   int
	AlertError    string
	ExecDone      bool
	ExecError     string
	Clipboard     string
	CtrlC         int
	QuitRequested bool
	Exited        bool
	Capabilities  flatte.Capabilities
}

Snapshot is the app-owned result of the common host scenario.

type State

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

State belongs to the scenario app. Its mutex only lets a host adapter inspect completed loop transitions while the host is still running.

func (*State) Read

func (s *State) Read() Snapshot

Read returns a copy of the scenario state.

Jump to

Keyboard shortcuts

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