Skip to content
Merged
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
22 changes: 11 additions & 11 deletions tests/test_ensure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,18 +153,18 @@ fn test_closure() {
// identifier, nor as `(S + move || 1) == (1)` by misinterpreting the
// closure precedence.
let test = || Ok(ensure!(S + move || 1 == 1));
assert_err(test, "Condition failed: `S + (move || 1 == 1)`");
assert_err(test, "Condition failed: `S + move || 1 == 1`");

let test = || Ok(ensure!(S + || 1 == 1));
assert_err(test, "Condition failed: `S + (|| 1 == 1)`");
assert_err(test, "Condition failed: `S + || 1 == 1`");

// Must not partition as `S + ((move | ()) | 1) == 1` by treating those
// pipes as bitwise-or.
let test = || Ok(ensure!(S + move |()| 1 == 1));
assert_err(test, "Condition failed: `S + (move |()| 1 == 1)`");
assert_err(test, "Condition failed: `S + move |()| 1 == 1`");

let test = || Ok(ensure!(S + |()| 1 == 1));
assert_err(test, "Condition failed: `S + (|()| 1 == 1)`");
assert_err(test, "Condition failed: `S + |()| 1 == 1`");
}

#[test]
Expand Down Expand Up @@ -224,7 +224,7 @@ fn test_if() {
let test = || Ok(ensure!(if let | 1 | 2 = 2 {}.t(1) == 2));
assert_err(
test,
"Condition failed: `if let 1 | 2 = 2 {}.t(1) == 2` (1 vs 2)",
"Condition failed: `if let | 1 | 2 = 2 {}.t(1) == 2` (1 vs 2)",
);
}

Expand Down Expand Up @@ -269,7 +269,7 @@ fn test_loop() {
let test = || Ok(ensure!(for | _x in iter::once(0) {}.t(1) == 2));
assert_err(
test,
"Condition failed: `for _x in iter::once(0) {}.t(1) == 2` (1 vs 2)",
"Condition failed: `for | _x in iter::once(0) {}.t(1) == 2` (1 vs 2)",
);

#[rustfmt::skip]
Expand All @@ -286,7 +286,7 @@ fn test_match() {
let test = || Ok(ensure!(match 1 == 1 { true => 1, false => 0 } == 2));
assert_err(
test,
"Condition failed: `match 1 == 1 { true => 1, false => 0, } == 2` (1 vs 2)",
"Condition failed: `match 1 == 1 { true => 1, false => 0 } == 2` (1 vs 2)",
);
}

Expand Down Expand Up @@ -343,7 +343,7 @@ fn test_path() {
let test = || Ok(ensure!(Error::msg::<&str,>.t(1) == 2));
assert_err(
test,
"Condition failed: `Error::msg::<&str>.t(1) == 2` (1 vs 2)",
"Condition failed: `Error::msg::<&str,>.t(1) == 2` (1 vs 2)",
);

let test = || Ok(ensure!(Error::msg::<<str as ToOwned>::Owned>.t(1) == 2));
Expand All @@ -362,7 +362,7 @@ fn test_path() {
let test = || Ok(ensure!(Chain::<'static,>::new.t(1) == 2));
assert_err(
test,
"Condition failed: `Chain::<'static>::new.t(1) == 2` (1 vs 2)",
"Condition failed: `Chain::<'static,>::new.t(1) == 2` (1 vs 2)",
);

fn f<const I: isize>() {}
Expand Down Expand Up @@ -394,7 +394,7 @@ fn test_path() {

#[rustfmt::skip]
let test = || Ok(ensure!(E::U::<u8,>>E::U));
assert_err(test, "Condition failed: `E::U::<u8> > E::U` (U vs U)");
assert_err(test, "Condition failed: `E::U::<u8,> > E::U` (U vs U)");

let test = || Ok(ensure!(Generic::<dyn Debug + Sync> != Generic));
assert_err(
Expand All @@ -416,7 +416,7 @@ fn test_path() {
};
assert_err(
test,
"Condition failed: `Generic::<dyn Fn() + ::std::marker::Sync> != Generic` (Generic vs Generic)",
"Condition failed: `Generic::<dyn Fn::() + ::std::marker::Sync> != Generic` (Generic vs Generic)",
);
}

Expand Down