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