macro_rules! expect_ne {
($actual:expr, $expected:expr, $($format_args:expr),+ $(,)?) => { ... };
($actual:expr, $expected:expr $(,)?) => { ... };
}
Expand description
Marks test as failed and continues execution if the second argument is equal to first argument.
This is a not-fatal failure. The test continues execution even after the macro execution.
This can only be invoked inside tests with the
gtest
attribute. The failure must be generated
in the same thread as that running the test itself.
Example:
ⓘ
use googletest::prelude::*;
#[gtest]
fn should_fail() {
expect_ne!(1, 1);
println!("This will print!");
}
One may include formatted arguments in the failure message:
ⓘ
use googletest::prelude::*;
#[gtest]
fn should_fail() {
let argument = "argument"
expect_ne!(1, 1, "custom failure message: {argument}");
println!("This will print!");
}