mix bash_fixtures (JustBash v0.4.0)

View Source

Records what real bash does for the fixture comparison corpus.

Reads case files from test/fixtures/bash_cases/*.json, runs each script under real bash in a Docker container, and writes the resulting stdout, stderr and exit code to test/fixtures/bash_expected/*.json. JustBash.FixtureTest then asserts JustBash produces the same bytes, offline.

A whole suite is recorded in a single container: startup dominates per-case cost, so batching is what keeps recording the corpus tractable.

Cases and recordings are joined by content_hash, a digest of the case inputs computed by JustBash.Fixtures. Editing a script therefore changes its hash and orphans its recording, which mix bash_fixtures.verify detects offline — no Docker needed on the PR path.

Usage

# Record all suites
mix bash_fixtures

# Record specific suites
mix bash_fixtures wc sort arithmetic

# Rebuild the Docker image first
mix bash_fixtures --rebuild