contenttest

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 4 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 contenttest is the conformance suite of the provided documents of the extension contract (Documents().ProvideContent, OpenDiff, OpenDocument, Tabs, CloseTabs, Dirty and SaveAll, and ProvideMultiDiff and OpenMultiDiff of the multi-file diff editor): the host runs it over a window tab, and the fake of the tests of the extensions runs it too, so that an extension that passes its tests against the fake meets the same rules in the window.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, newHarness func(t *testing.T) *Harness)

Run runs the suite: newHarness makes a fresh harness for each test.

Types

type Harness

type Harness struct {
	// API is the API of the extension under test, in an activation that is on.
	API extension.API
	// Text asks the window for the text of a provided document, as it does when it opens one, from any goroutine; the error has the
	// tag ExtContentUnknown when no provider has the scheme.
	Text func(ctx context.Context, uri string) (string, error)
	// Label and Language ask the window for the name and the language of a provided document ("" for none).
	Label, Language func(uri string) string
	// Diffs, Docs and Changed are what the window was asked to open and what the provider said changed, since the start.
	Diffs   func() []extension.DiffSpec
	Docs    func() []extension.OpenSpec
	Changed func() [][]string
	// Deactivate ends the activation, as closing the window tab does.
	Deactivate func()
	// Failed tells whether the implementation took the extension off because of a panic in the provider.
	Failed func() bool
	// Pump lets the work posted to the UI thread run.
	Pump func()
	// MultiFiles asks the window for the files of a set of the multi-file diff editor, as it does when it opens the set, from any
	// goroutine; the error has the tag ExtMultiDiffKindUnknown when no provider has the kind. MultiOpened and MultiChanged are the
	// editors the window was asked to open and what the provider said changed, since the start.
	MultiFiles   func(ctx context.Context, kind, key string) ([]extension.MultiDiffResource, error)
	MultiOpened  func() []extension.MultiDiffSpec
	MultiChanged func() [][]string
}

Harness is what an implementation gives the suite.

Jump to

Keyboard shortcuts

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