@ 261101.7raw
current

Testing

Two kinds of test, split by what a rewrite in another language would keep.

Go tests

They check internals: parsers, edit distance, path math, the lexers against chroma. They also drive the handler in process, which is fast and covers most behavior. A rewrite deletes them.

Write new Go tests as tables, with the cases in testdata/ where they fit. Purpose: a later move to black-box form then reuses the data.

Black-box tests

They run the built binary and check what a user sees. They cover what in-process tests cannot reach: flag parsing, the listener, --public, process lifecycle and browser pages. The first case is a missing path on --public, which shows the 404 coin.

The suite is pytest in tests/, with its own pyproject.toml. make blackbox builds the binary and runs it. Only HTTP cases exist so far; the CLI, browser and process kinds below come with their first case.

Rules for the suite:

Race detector

Run go test -race when a change touches locks, restart, serve or the watcher.

Heavy runs

Corpus crawl, differential lexing, fuzzing, mutation testing and soak runs go on the user’s own machine. The model writes the script and its instructions in csi/sketch/. The user runs it and names the output path.

Later

The large Go tests, starting with web_test.go, move to black-box form when a rewrite is decided. The old binary then serves as the check on the new cases, and the same suite runs against both.