asmov_common_testing/
testing.rs1use std::{fmt::Display, path::Path};
2use crate::*;
3
4pub trait Testing {
6 fn use_case(&self)-> UseCase;
8
9 fn namepath(&self) -> &Namepath;
11
12 fn fixture_dir(&self) -> &Path;
15
16 fn temp_dir(&self) -> &Path;
20}
21
22#[derive(Debug, Copy, Clone, PartialEq, Eq)]
24pub enum UseCase {
25 Unit,
27 Integration,
29}
30
31impl Display for UseCase {
32 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
33 match self {
34 UseCase::Unit => write!(f, "unit"),
35 UseCase::Integration => write!(f, "integration"),
36 }
37 }
38}
39
40#[derive(Debug, Clone, Copy, PartialEq, Eq)]
42pub enum TestingKind {
43 Module,
45 Group,
47 Test
49}
50
51impl Display for TestingKind {
52 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
53 match self {
54 TestingKind::Module => write!(f, "module"),
55 TestingKind::Group => write!(f, "group"),
56 TestingKind::Test => write!(f, "test"),
57 }
58 }
59}