mod config;
mod list;
mod registry;
mod result;
mod status;
pub use self::config::{TestConfig, TestConfigError};
pub use self::list::TestList;
pub use self::registry::{DefaultTestRegistry, TestRegistry};
pub use self::result::TestResult;
pub use self::status::TestStatus;
use std::{
path::{Path, PathBuf},
sync::Arc,
time::Duration,
};
use crate::suite::TestSuite;
pub struct Test {
link: intrusive_collections::LinkedListAtomicLink,
pub suite: Arc<TestSuite>,
pub config: Arc<TestConfig>,
pub name: Arc<str>,
pub path: PathBuf,
pub absolute_path: PathBuf,
pub xfail_not: bool,
pub previous_failure: Option<TestResult>,
pub previous_elapsed: Option<Duration>,
}
impl Test {
pub fn new(path_in_suite: PathBuf, suite: Arc<TestSuite>, config: Arc<TestConfig>) -> Self {
let absolute_path = suite.source_dir.get_ref().join(&path_in_suite);
let name =
Arc::from(format!("{}::{}", suite.name(), path_in_suite.display()).into_boxed_str());
Self {
link: Default::default(),
suite,
config,
name,
path: path_in_suite,
absolute_path,
xfail_not: false,
previous_failure: None,
previous_elapsed: None,
}
}
pub fn name(&self) -> &str {
self.name.as_ref()
}
pub fn source_path(&self) -> &Path {
self.absolute_path.as_path()
}
}