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
use matchers::matcher::Matcher;

#[derive(Copy, Clone)]
pub struct BeFalse {
    file_line: (&'static str, u32)
}

impl Matcher<bool> for BeFalse {
    #[allow(unused_variables)] fn assert_check(&self, expected: bool) -> bool {
        expected == false
    }

    #[allow(unused_variables)] fn msg(&self, expected: bool) -> String {
        format!("Expected {} to be false but it was not.", stringify!(expected))
    }

    #[allow(unused_variables)] fn negated_msg(&self, expected: bool) -> String {
        format!("Expected {} NOT to be false but it was.", stringify!(expected))
    }

    fn get_file_line(&self) -> (&'static str, u32) {
        self.file_line
    }
}

pub fn be_false(file_line: (&'static str, u32)) -> Box<BeFalse> {
    Box::new(BeFalse { file_line: file_line })
}

#[macro_export]
macro_rules! be_false(
    () => (
        be_false((file!(), expand_line!()))
    );
);