litcheck_lit/
lib.rs

1#![feature(iter_intersperse)]
2
3pub mod config;
4pub mod format;
5pub mod formats;
6pub mod suite;
7pub mod test;
8pub(crate) mod utils;
9
10pub use self::config::Config;
11pub use self::format::TestFormat;
12pub use self::suite::{DefaultTestSuiteRegistry, TestSuite, TestSuiteError, TestSuiteRegistry};
13pub use self::test::{Test, TestConfig, TestConfigError, TestRegistry, TestResult, TestStatus};
14
15use litcheck::diagnostics::Diagnostic;
16
17pub type FxIndexMap<K, V> =
18    indexmap::IndexMap<K, V, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>;
19
20#[derive(Diagnostic, Debug, thiserror::Error)]
21pub enum LitError {
22    #[error("did not discover any tests for provided path(s)")]
23    #[diagnostic()]
24    NoTests,
25    #[error("no tests selected (of {available} available)")]
26    #[diagnostic()]
27    NoTestsSelected { available: usize },
28    #[error("one or more tests failed")]
29    #[diagnostic()]
30    TestsFailed,
31    #[error(transparent)]
32    #[diagnostic(transparent)]
33    TestSuite(#[from] TestSuiteError),
34    #[error(transparent)]
35    #[diagnostic(transparent)]
36    TestConfig(#[from] TestConfigError),
37    #[error(transparent)]
38    #[diagnostic(transparent)]
39    TestScript(#[from] formats::InvalidTestScriptError),
40    #[error("invalid test path '{}': paths must be located under the current working directory", .0.display())]
41    TestPath(std::path::PathBuf),
42}