Skip to content

Commit

Permalink
Add test of long debug
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Nov 22, 2021
1 parent f506623 commit 4e4ada2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_ensure.rs
Expand Up @@ -365,3 +365,15 @@ fn test_trailer() {
"Condition failed: `err.is::<<str as ToOwned>::Owned>() == true` (false vs true)",
);
}

#[test]
fn test_too_long() {
let test = || Ok(ensure!("" == "x".repeat(10)));
assert_err(
test,
"Condition failed: `\"\" == \"x\".repeat(10)` (\"\" vs \"xxxxxxxxxx\")",
);

let test = || Ok(ensure!("" == "x".repeat(80)));
assert_err(test, "Condition failed: `\"\" == \"x\".repeat(80)`");
}

0 comments on commit 4e4ada2

Please sign in to comment.