Tests

Run make test to build the optimized binary and run the complete test suite. It checks correctness only. Run make test-debug to test the debug build.

Run make bench to run the optimized test suite with the --bench option. Most test scripts currently ignore the option. test-js-libs.sh uses it to compare the JavaScript library size-reduction results to the documented baseline.

Every test script prints its name followed by PASSED when it succeeds. Failed tests print the test name followed by FAILED, then their diagnostics. test-js-libs.sh prints SKIPPED and its reason when neither Bun nor Node.js, or neither wget nor curl, is available. It also prints the JavaScript runtime it used. If the terminal supports colours, the PASSED and FAILED statuses are coloured green or red.

Test configuration

Test scripts use the following environment variables. The Makefile supplies the two WEBMINCER_ variables; they are useful when running individual test scripts against another build.

The scripts use the normal shell PATH to locate required commands, including bun or node, wget, and curl. test-js-libs.sh prefers Bun for JavaScript validation and falls back to Node.js. It skips instead of failing when neither JavaScript runtime or downloader is available.

Tests with persistent test data store it in .test/stageX/test-name/, matching the test's stage and name.

Run make test-clean to remove the persistent test data.

Test stages

The Makefile discovers test-*.sh scripts in tests/stage*/ and runs them in stage and filename order. TEST_STAGES limits discovery to a space-separated list of stage numbers. For example, make TEST_STAGES='1 2' test runs only stages 1 and 2. Place a new test in the stage that matches its cost and diagnostic value. Use zero-padded stage names if there are ten or more stages.

Stage 1

Stage 2

Stage 3

Stage 4

Shared test helpers