1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use super::*;
#[extend::ext(name=SweetBool)]
pub impl bool {
/// Performs an assertion ensuring this value is equal to `true`.
///
/// ## Example
///
/// ```
/// # use sweet::prelude::*;
/// true.xpect_true();
/// ```
///
/// ## Panics
///
/// Panics if the value is not `true`.
fn xpect_true(&self) -> &Self {
assert_ext::assert_expected_received_display(self, &true);
self
}
/// Performs an assertion ensuring this value is equal to `false`.
///
/// ## Example
///
/// ```
/// # use sweet::prelude::*;
/// false.xpect_false();
/// ```
///
/// ## Panics
///
/// Panics if the value is not `false`.
fn xpect_false(&self) -> &Self {
assert_ext::assert_expected_received_display(self, &false);
self
}
}
#[cfg(test)]
mod test {
use crate::prelude::*;
#[test]
fn bool() {
true.xpect_true();
false.xpect_false();
}
}