pub trait ConsumableFixture: Sized {
// Required method
fn set_up() -> Result<Self>;
}Expand description
Interface for structure to be set up before the test case.
Types implementing ConsumableFixture can be passed by value to
a test function.
ⓘ
struct MyFixture { ... }
impl ConsumableFixture for MyFixture { ... }
#[gtest]
fn test_with_fixture(my_fixture: MyFixture) {...}Required Methods§
Sourcefn set_up() -> Result<Self>
fn set_up() -> Result<Self>
Factory method of the ConsumableFixture.
This method is called by the test harness before the test case
that uses this fixture. If this method returns an Err(...),
then the test case is not evaluated, automatically fails, and
only the fixtures previously set up are torn down.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".