Files
Marlin/tests/test.md
thePR0M3TH3AN 9ed57d15c7 update
2025-05-16 16:07:23 -04:00

69 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Testing
Below is a **repeat-able 3-step flow** you can use **every time you pull fresh code**.
---
## 0 Prepare once
```bash
# 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
```bash
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
```bash
# 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
```bash
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)
```bash
git pull && cargo build --release &&
sudo install -Dm755 target/release/marlin /usr/local/bin/marlin &&
cargo test --test e2e -- --nocapture
```
Stick that in a shell alias (`alias marlin-ci='…'`) and youve got a 5-second upgrade-and-verify loop.