mirror of https://github.com/zkat/miette.git
Add compiletest for enum error types
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
0a4cf4ad24
commit
0b32574d5b
|
|
@ -18,3 +18,22 @@ fn test_diagnostic_source() {
|
|||
};
|
||||
assert!(error.diagnostic_source().is_some());
|
||||
}
|
||||
|
||||
// Compiletest this:
|
||||
#[derive(thiserror::Error, miette::Diagnostic, Debug)]
|
||||
enum EnumError {
|
||||
#[error("Some Error text")]
|
||||
SyntaxErr(#[from] AnErr),
|
||||
}
|
||||
|
||||
// Compiletest this:
|
||||
#[derive(thiserror::Error, miette::Diagnostic, Debug)]
|
||||
enum AnotherEnumError {
|
||||
#[error("Some other Error Text")]
|
||||
SyntaxErr {
|
||||
#[from]
|
||||
#[source]
|
||||
#[diagnostic_source]
|
||||
source: AnErr,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue