Files
Marlin/cli-bin/tests/test.md
thePR0M3TH3AN f6fca2c0dd update
2025-05-18 16:02:48 -04:00

1.7 KiB
Raw Blame History

Testing

Below is a repeat-able 3-step flow you can use every time you pull fresh code.


0 Prepare once

# Run once (or add to ~/.bashrc) so debug + release artefacts land
# in the same predictable place.  Speeds-up future builds.
export CARGO_TARGET_DIR=target

1 Build the new binary

git pull             # grab the latest commit
cargo build --release
sudo install -Dm755 target/release/marlin /usr/local/bin/marlin
  • cargo build --release builds the optimised binary.
  • install … copies it into your $PATH so marlin on the CLI is the fresh one.

2 Run the smoke-test suite

# Runs the end-to-end test we added in tests/e2e.rs
cargo test --test e2e -- --nocapture
  • --test e2e compiles and runs only tests/e2e.rs; other unit-tests are skipped (add them later if you like).
  • --nocapture streams stdout/stderr so you can watch each CLI step in real time.
  • Exit-code 0 ➜ everything passed. Any non-zero exit or a red ✗ line means a step failed; the asserts diff will show the command and its output.

3 (Optionally) run all tests

cargo test --all -- --nocapture

This will execute:

  • unit tests in src/**
  • every file in tests/
  • doc-tests

If you wire “cargo test --all” into CI (GitHub Actions, GitLab, etc.), pushes that break a workflow will be rejected automatically.


One-liner helper (copy/paste)

cargo build --release &&
sudo install -Dm755 target/release/marlin /usr/local/bin/marlin &&
cargo test --all -- --nocapture

Stick that in a shell alias (alias marlin-ci='…') and youve got a 5-second upgrade-and-verify loop.