extensiontest

package
v0.23.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package extensiontest is the test kit of an extension repository, as Test kit in contract.md defines. One test of the repository calls Run. Run checks the links between the manifest, the skill, the scenarios, and the Nicely versions. It then installs the real ncly-<slug> and the ncly of go tool ncly in scratch folders, and runs the scenarios of testdata/script/.

A scenario runs the extension through the commands that the kit adds, so that the kit checks each answer against the schema of its command:

ncly <arg>...                 runs ncly, which exits 0, or not 0 after !
ncly-<slug> <arg>...          runs the extension directly, the same way
exits <code> <command> <arg>  runs a command, these two included, and checks its exact exit code
grant <service>               grants the key of a declared service to the extension
fake <name>                   puts the fake child in $WORK/bin as name

The rules of its code:

  • No case reads the user's keychain, HOME, or XDG folders, or finds the user's extensions. Each scenario gets a scratch HOME and scratch XDG folders, and a PATH without the folders that hold an ncly-* file. Each service that the manifest declares gets the sentinel key sentinel-<service> in its variable, so ncly never reads the keychain for it. On Linux, D-Bus names no bus, so a read that a scenario forces finds no keychain
  • The kit imports no package of core's internal/, which an extension repository cannot import either
  • The kit builds every program that it runs from Go source: the extension, ncly, and the fake child of the fake/ folder
  • Each failure names its file, the missing link, and its fix

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, e extension.Extension)

Run tests the extension repository that holds the current folder, whose extension is e. It reports each broken link, then runs each scenario as a subtest of t.

func TestExtension(t *testing.T) { extensiontest.Run(t, Extension) }

Types

This section is empty.

Directories

Path Synopsis
Command fake is the fake child of the test kit.
Command fake is the fake child of the test kit.

Jump to

Keyboard shortcuts

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