261030.4 · 6182a9aa802e833d238ab04b403b428f42fe37f9
A black-box suite runs the built binary, starting with the 404 coin
make blackbox runs tests/ with pytest and httpx against a server in a throwaway home, on --public and on the form wwwvm's unit uses. Cases are TOML files named after the decision they check.
The coin shows on both forms for a path a served repo lacks. The cache message appears only without --public, for a path that names no repo.
reading declarations
Changes to doc/. All files
@@ -12,7 +12,7 @@ Write new Go tests as tables, with the cases in `testdata/` where they fit. Purp 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`, run by `uv run pytest`:+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. - CLI: `subprocess` checks stdout, stderr and the exit code apart, including `E{code}` messages - HTTP: `httpx` against a server the suite starts on a free port@@ -21,8 +21,11 @@ The suite is pytest in `tests/`, with its own `pyproject.toml`, run by `uv run p Rules for the suite: -- It reads the binary from `WWW_BIN` and assumes nothing else about it-- A case is a data file: argv with expected stdout and exit code, or a request with the expected page. A parametrized test loads it+- It reads the binary from `TEST_BIN` and assumes nothing else about it+- A case is a TOML file in `tests/cases/`: argv with expected stdout and exit code, or a request with the expected page. A parametrized test loads it+- A case names the server forms it runs on: `public`, the `--public` flag, or `default`, a reader's server, as wwwvm's unit runs it+- A case compares the page without its script and style, since a reader never sees their words+- `tests/harness.py` seeds the cache on disk, since a public server clones only over https from the open internet. It is the one place the suite knows the cache's layout - Name each case after the decision it checks - Make runs repeatable: git repos built with fixed dates, a throwaway `HOME` and `XDG_*`, a free port, no network - Replace volatile parts in expected output before comparing: stardates, timestamps, ports, temp paths