Skip to main content

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