5个版本 (3个破坏性更新)
| 0.4.0 | 2023年9月16日 | 
|---|---|
| 0.3.0 | 2023年9月16日 | 
| 0.2.0 | 2023年2月6日 | 
| 0.1.1 | 2023年1月3日 | 
| 0.1.0 | 2023年1月3日 | 
#5 in #predicates
5KB
90 代码行
googletest-predicates
提供将googletest匹配器转换为谓词的功能。这使您可以使用googletest库编写丰富的匹配器逻辑,并在其他期望predicates的库中重用它。
例如,当使用mockall进行类型模拟时,您可以通过使用此库提供的matcher函数来包装googletest匹配器,例如eq。
use googletest::{expect_that, matchers::*};
use googletest_predicates::matcher;
let mut mock = MockMyTrait::new();
mock.expect_foo()
    .with(matcher(eq(1)))
    .times(1)
    .returning(|x| x + 1);
expect_that!(mock.foo(1), eq(2))
依赖关系
~3–4.5MB
~86K SLoC