1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use std::path::PathBuf;

use litcheck::diagnostics::{Diagnostic, SourceSpan};

use crate::test::TestConfigError;

#[derive(Debug, Diagnostic, thiserror::Error)]
pub enum TestSuiteError {
    #[error(transparent)]
    #[diagnostic(transparent)]
    Config(#[from] TestConfigError),
    #[error("failed to parse test suite configuration")]
    #[diagnostic()]
    Syntax {
        #[label("{error}")]
        span: Option<SourceSpan>,
        #[source]
        error: toml::de::Error,
    },
    #[error("invalid test suite configuration")]
    #[diagnostic()]
    EmptyName {
        #[label("name cannot be empty")]
        span: SourceSpan,
    },
    #[error("invalid test suite configuration")]
    #[diagnostic()]
    InvalidSourceDir {
        #[label("source directory '{}' is not a directory", .source_dir.display())]
        span: SourceSpan,
        source_dir: PathBuf,
    },
    #[error("invalid test suite configuration")]
    #[diagnostic()]
    InvalidWorkingDir {
        #[label("working directory '{}' is not a directory", .working_dir.display())]
        span: SourceSpan,
        working_dir: PathBuf,
    },
}