@@ -9,22 +9,41 @@ pub struct AssertInfo<'a> {
9
9
pub message : Option < crate :: fmt:: Arguments < ' a > > ,
10
10
}
11
11
12
+ /// Details about the expression that failed an assertion.
12
13
#[ derive( Debug ) ]
13
14
pub enum Assertion < ' a > {
14
- /// The assertion is a boolean assertion.
15
+ /// The failed assertion is a boolean expression.
16
+ ///
17
+ /// This variant is only used for expressions that can't be described more specifically
18
+ /// by another variant.
15
19
Bool ( BoolAssertion ) ,
16
- /// The assertion is a binary comparison assertion.
20
+
21
+ /// The failed assertion is a binary comparison expression.
22
+ ///
23
+ /// This is used by `assert_eq!()`, `assert_ne!()` and expressions like
24
+ /// `assert!(x > 10)`.
17
25
Binary ( BinaryAssertion < ' a > ) ,
18
26
}
19
27
20
28
/// Information about a failed boolean assertion.
29
+ ///
30
+ /// The expression was asserted to be true, but it evaluated to false.
31
+ ///
32
+ /// This struct is only used for assertion failures that can't be described more specifically
33
+ /// by another assertion type.
21
34
#[ derive( Debug ) ]
22
35
pub struct BoolAssertion {
23
- /// The expression that was evaluated.
36
+ /// The expression that was evaluated to false .
24
37
pub expr : & ' static str ,
25
38
}
26
39
27
40
/// Information about a failed binary comparison assertion.
41
+ ///
42
+ /// The left expression was compared with the right expression using `op`,
43
+ /// and the comparison evaluted to false.
44
+ ///
45
+ /// This struct is used for `assert_eq!()`, `assert_ne!()` and expressions like
46
+ /// `assert!(x > 10)`.
28
47
#[ derive( Debug ) ]
29
48
pub struct BinaryAssertion < ' a > {
30
49
/// The operator used to compare left and right.
0 commit comments