Debian Codegraph @

debian/rust-vendor/rstest/src/context.rs

raw
1 /// A test context.
2 #[non_exhaustive]
3 pub struct Context {
4 /// The complete module test path
5 pub module: &'static str,
6 /// The test function name
7 pub name: &'static str,
8 /// The test description if present
9 pub description: Option<&'static str>,
10 /// The cardinal case number if it's a test case
11 pub case: Option<usize>,
12 /// Start time
13 pub start: std::time::Instant,
14 }
15
16 impl Context {
17 /// Create a new test context. This function set also the start time to the current time.
18 pub fn new(
19 module: &'static str,
20 name: &'static str,
21 description: Option<&'static str>,
22 case: Option<usize>,
23 ) -> Self {
24 Self {
25 module,
26 name,
27 description,
28 case,
29 start: std::time::Instant::now(),
30 }
31 }
32 }