From 024dfee33c89297ef862fefdf8e1db78574c5b5c Mon Sep 17 00:00:00 2001 From: Matthias Seiffert Date: Thu, 3 Oct 2019 14:38:04 +0200 Subject: [PATCH] Update unit_cmp tests to include blocks for asserts --- tests/ui/unit_cmp.rs | 36 +++++++++++++++++++++++++++---- tests/ui/unit_cmp.stderr | 46 ++++++++++++++++++++++++++++++---------- 2 files changed, 67 insertions(+), 15 deletions(-) diff --git a/tests/ui/unit_cmp.rs b/tests/ui/unit_cmp.rs index 71c4348a2a1..8d3a4eed82e 100644 --- a/tests/ui/unit_cmp.rs +++ b/tests/ui/unit_cmp.rs @@ -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; + } + ); } diff --git a/tests/ui/unit_cmp.stderr b/tests/ui/unit_cmp.stderr index eeeef05d002..578a6218ee0 100644 --- a/tests/ui/unit_cmp.stderr +++ b/tests/ui/unit_cmp.stderr @@ -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) -- 2.44.0