fluent_test/backend/modifiers/
not.rs1use crate::backend::Assertion;
2
3pub trait NotModifier<T> {
5 fn not(self) -> Self;
7}
8
9impl<T: Clone> NotModifier<T> for Assertion<T> {
10 fn not(self) -> Self {
14 return Self {
15 value: self.value.clone(),
16 expr_str: self.expr_str,
17 negated: !self.negated,
18 steps: self.steps.clone(),
19 in_chain: self.in_chain, is_final: self.is_final, };
22 }
23}
24
25#[cfg(test)]
26mod tests {
27 use crate::prelude::*;
28
29 #[test]
30 fn test_not_modifier() {
31 crate::Reporter::disable_deduplication();
33
34 let value = 42;
35
36 expect!(value).not().to_equal(100);
38 expect!(value).not().to_be_less_than(10);
39
40 let chain = expect!(value)
42 .not()
43 .to_be_less_than(30) .and()
45 .not()
46 .to_be_greater_than(50); let result = chain.evaluate();
49 assert!(result, "NOT chain with AND should evaluate to true when both conditions are true");
50 }
51}