Skip to main content

A modern Cram-like shell test runner

Project description

outmatch

Output matching for shell commands. A modern replacement for Cram with a cleaner interface, dynamic test generation, multiple tests per file, and zero dependencies.

Write a test — just a command and its expected output:

Example .om test file with syntax highlighting

Run it:

All tests passing

When something breaks, you get a clear diff:

Failing tests with colored diff output

Fix it automatically — outmatch rewrites expected output in-place:

outmatch --fix accepting actual output

Install

pip install outmatch

Or with uv:

uv tool install outmatch

CLI

outmatch [FILES...]           # Run tests (default: all *.om recursively)
outmatch --fix [FILES...]     # Accept actual output as expected
outmatch -i [FILES...]        # Interactive — review each failure

File Format

Tests live in .om files. Each test starts with a ## header, followed by a $ command and its expected output:

# Comments at column 0

## name of test
  $ command to run
  expected output line
  /regex pattern to match/
  glob: glob pattern to match
  exit 1

Dynamic Test Generation

The | @foreach syntax generates tests from command output — one test per line:

## check each fruit
  $ cat fruits.txt | @foreach @FRUIT
    $ echo "I like @FRUIT"

  apple
    I like apple
  banana
    I like banana

Run outmatch --fix to capture output inline.

How It Differs from Cram

Cram Outmatch
Tests per file One Many (## headers)
Dynamic generation No | @foreach pipelines
Regex matching re suffix /pattern/ delimiters
Glob matching glob suffix glob: prefix
Fix mode --interactive outmatch --fix (automatic)
Generated output No Inline, per item
Dependencies Python 2/3 Python 3.10+, zero deps

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

outmatch-0.3.0.dev11.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

outmatch-0.3.0.dev11-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file outmatch-0.3.0.dev11.tar.gz.

File metadata

  • Download URL: outmatch-0.3.0.dev11.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for outmatch-0.3.0.dev11.tar.gz
Algorithm Hash digest
SHA256 2d970dc30c59980a87addb4fcefdf0972345eb0c5868a7bdc3d8527cfaa0e91a
MD5 e2dede34b5fed3e4b3e92942b12d77ad
BLAKE2b-256 6c5920201ffe6c85ecffa4edd55424f7814586a0271993f6f538d29c7bc097df

See more details on using hashes here.

File details

Details for the file outmatch-0.3.0.dev11-py3-none-any.whl.

File metadata

  • Download URL: outmatch-0.3.0.dev11-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for outmatch-0.3.0.dev11-py3-none-any.whl
Algorithm Hash digest
SHA256 f936b177b2b839ca6ac4afc12a8cf902f435f0fd9573d68bd2044277b16244cb
MD5 2aab3687f9fe26a3ad7c7d6a7eafcc12
BLAKE2b-256 20453c873ff47d7abb92864ad597bba05617b289560d85b45ed9d5e02dee7efd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page