1#![forbid(unsafe_code)]
2#![doc = include_str!("../README.md")]
3
4#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
6pub enum TestFixtureScope {
7 Case,
8 Suite,
9 Module,
10 Session,
11}
12
13#[derive(Clone, Debug, Eq, Hash, PartialEq)]
15pub struct TestFixture {
16 pub name: String,
17 pub scope: TestFixtureScope,
18}
19
20impl TestFixture {
21 pub fn new(name: impl Into<String>, scope: TestFixtureScope) -> Self {
22 Self {
23 name: name.into(),
24 scope,
25 }
26 }
27
28 pub fn name(&self) -> &str {
29 &self.name
30 }
31
32 pub const fn scope(&self) -> TestFixtureScope {
33 self.scope
34 }
35}
36
37#[cfg(test)]
38mod tests {
39 use super::{TestFixture, TestFixtureScope};
40
41 #[test]
42 fn creates_fixture_metadata() {
43 let fixture = TestFixture::new("temp-dir", TestFixtureScope::Suite);
44
45 assert_eq!(fixture.name(), "temp-dir");
46 assert_eq!(fixture.scope(), TestFixtureScope::Suite);
47 }
48}