Update unit_cmp tests to include blocks for asserts

This commit is contained in:
Matthias Seiffert 2019-10-03 14:38:04 +02:00
parent fb25d56799
commit 024dfee33c
2 changed files with 67 additions and 15 deletions

View file

@ -21,9 +21,37 @@ fn main() {
false;
} {}
assert_eq!((), ());
debug_assert_eq!((), ());
assert_eq!(
{
true;
},
{
false;
}
);
debug_assert_eq!(
{
true;
},
{
false;
}
);
assert_ne!((), ());
debug_assert_ne!((), ());
assert_ne!(
{
true;
},
{
false;
}
);
debug_assert_ne!(
{
true;
},
{
false;
}
);
}

View file

@ -25,32 +25,56 @@ LL | | } {}
error: `assert_eq` of unit values detected. This will always succeed
--> $DIR/unit_cmp.rs:24:5
|
LL | assert_eq!((), ());
| ^^^^^^^^^^^^^^^^^^^
LL | / assert_eq!(
LL | | {
LL | | true;
LL | | },
... |
LL | | }
LL | | );
| |______^
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: `debug_assert_eq` of unit values detected. This will always succeed
--> $DIR/unit_cmp.rs:25:5
--> $DIR/unit_cmp.rs:32:5
|
LL | debug_assert_eq!((), ());
| ^^^^^^^^^^^^^^^^^^^^^^^^^
LL | / debug_assert_eq!(
LL | | {
LL | | true;
LL | | },
... |
LL | | }
LL | | );
| |______^
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: `assert_ne` of unit values detected. This will always fail
--> $DIR/unit_cmp.rs:27:5
--> $DIR/unit_cmp.rs:41:5
|
LL | assert_ne!((), ());
| ^^^^^^^^^^^^^^^^^^^
LL | / assert_ne!(
LL | | {
LL | | true;
LL | | },
... |
LL | | }
LL | | );
| |______^
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: `debug_assert_ne` of unit values detected. This will always fail
--> $DIR/unit_cmp.rs:28:5
--> $DIR/unit_cmp.rs:49:5
|
LL | debug_assert_ne!((), ());
| ^^^^^^^^^^^^^^^^^^^^^^^^^
LL | / debug_assert_ne!(
LL | | {
LL | | true;
LL | | },
... |
LL | | }
LL | | );
| |______^
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)