Skip to content

Commit 024dfee

Browse files
committed
Update unit_cmp tests to include blocks for asserts
1 parent fb25d56 commit 024dfee

File tree

2 files changed

+67
-15
lines changed

2 files changed

+67
-15
lines changed

tests/ui/unit_cmp.rs

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,37 @@ fn main() {
2121
false;
2222
} {}
2323

24-
assert_eq!((), ());
25-
debug_assert_eq!((), ());
24+
assert_eq!(
25+
{
26+
true;
27+
},
28+
{
29+
false;
30+
}
31+
);
32+
debug_assert_eq!(
33+
{
34+
true;
35+
},
36+
{
37+
false;
38+
}
39+
);
2640

27-
assert_ne!((), ());
28-
debug_assert_ne!((), ());
41+
assert_ne!(
42+
{
43+
true;
44+
},
45+
{
46+
false;
47+
}
48+
);
49+
debug_assert_ne!(
50+
{
51+
true;
52+
},
53+
{
54+
false;
55+
}
56+
);
2957
}

tests/ui/unit_cmp.stderr

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,56 @@ LL | | } {}
2525
error: `assert_eq` of unit values detected. This will always succeed
2626
--> $DIR/unit_cmp.rs:24:5
2727
|
28-
LL | assert_eq!((), ());
29-
| ^^^^^^^^^^^^^^^^^^^
28+
LL | / assert_eq!(
29+
LL | | {
30+
LL | | true;
31+
LL | | },
32+
... |
33+
LL | | }
34+
LL | | );
35+
| |______^
3036
|
3137
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
3238

3339
error: `debug_assert_eq` of unit values detected. This will always succeed
34-
--> $DIR/unit_cmp.rs:25:5
40+
--> $DIR/unit_cmp.rs:32:5
3541
|
36-
LL | debug_assert_eq!((), ());
37-
| ^^^^^^^^^^^^^^^^^^^^^^^^^
42+
LL | / debug_assert_eq!(
43+
LL | | {
44+
LL | | true;
45+
LL | | },
46+
... |
47+
LL | | }
48+
LL | | );
49+
| |______^
3850
|
3951
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
4052

4153
error: `assert_ne` of unit values detected. This will always fail
42-
--> $DIR/unit_cmp.rs:27:5
54+
--> $DIR/unit_cmp.rs:41:5
4355
|
44-
LL | assert_ne!((), ());
45-
| ^^^^^^^^^^^^^^^^^^^
56+
LL | / assert_ne!(
57+
LL | | {
58+
LL | | true;
59+
LL | | },
60+
... |
61+
LL | | }
62+
LL | | );
63+
| |______^
4664
|
4765
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
4866

4967
error: `debug_assert_ne` of unit values detected. This will always fail
50-
--> $DIR/unit_cmp.rs:28:5
68+
--> $DIR/unit_cmp.rs:49:5
5169
|
52-
LL | debug_assert_ne!((), ());
53-
| ^^^^^^^^^^^^^^^^^^^^^^^^^
70+
LL | / debug_assert_ne!(
71+
LL | | {
72+
LL | | true;
73+
LL | | },
74+
... |
75+
LL | | }
76+
LL | | );
77+
| |______^
5478
|
5579
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
5680

0 commit comments

Comments
 (0)