Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,19 @@ fn trace_diff_from_json() {
fn trace_max_weight_exceeded() {
let p = common::TestProject::new();
// Threshold of 1 byte -- guaranteed to exceed
chainsaw()
let output = chainsaw()
.args(["trace", "--max-weight", "1", "--no-cache"])
.arg(&p.entry)
.assert()
.failure()
.stderr(predicate::str::contains("exceeds --max-weight"));
.output()
.unwrap();
assert!(!output.status.success());
let stderr = String::from_utf8_lossy(&output.stderr);
// The error must appear exactly once (not duplicated by both eprintln and main handler).
let count = stderr.matches("exceeds --max-weight").count();
assert_eq!(
count, 1,
"expected error to appear exactly once, got {count}; stderr:\n{stderr}"
);
}

#[test]
Expand Down
Loading