mirror of https://github.com/zkat/miette.git
tests: have at least one test with multiple causes
This commit is contained in:
parent
6422f82174
commit
00ebb13ea6
|
|
@ -333,9 +333,11 @@ line5
|
||||||
#[test]
|
#[test]
|
||||||
fn multiline_highlight_no_label() -> Result<(), MietteError> {
|
fn multiline_highlight_no_label() -> Result<(), MietteError> {
|
||||||
#[derive(Debug, Diagnostic, Error)]
|
#[derive(Debug, Diagnostic, Error)]
|
||||||
#[error("oops!")]
|
#[error("wtf?!")]
|
||||||
#[diagnostic(code(oops::my::bad), help("try doing it better next time?"))]
|
#[diagnostic(code(oops::my::bad), help("try doing it better next time?"))]
|
||||||
struct MyBad {
|
struct MyBad {
|
||||||
|
#[source]
|
||||||
|
source: Inner,
|
||||||
src: NamedSource,
|
src: NamedSource,
|
||||||
#[snippet(src, message("This is the part that broke"))]
|
#[snippet(src, message("This is the part that broke"))]
|
||||||
ctx: SourceSpan,
|
ctx: SourceSpan,
|
||||||
|
|
@ -345,6 +347,14 @@ fn multiline_highlight_no_label() -> Result<(), MietteError> {
|
||||||
highlight2: SourceSpan,
|
highlight2: SourceSpan,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Error)]
|
||||||
|
#[error("something went wrong")]
|
||||||
|
struct Inner(#[source] InnerInner);
|
||||||
|
|
||||||
|
#[derive(Debug, Error)]
|
||||||
|
#[error("very much went wrong")]
|
||||||
|
struct InnerInner;
|
||||||
|
|
||||||
let src = r#"line1
|
let src = r#"line1
|
||||||
line2
|
line2
|
||||||
line3
|
line3
|
||||||
|
|
@ -354,6 +364,7 @@ line5
|
||||||
.to_string();
|
.to_string();
|
||||||
let len = src.len();
|
let len = src.len();
|
||||||
let err = MyBad {
|
let err = MyBad {
|
||||||
|
source: Inner(InnerInner),
|
||||||
src: NamedSource::new("bad_file.rs", src),
|
src: NamedSource::new("bad_file.rs", src),
|
||||||
ctx: (0, len).into(),
|
ctx: (0, len).into(),
|
||||||
highlight1: (0, len).into(),
|
highlight1: (0, len).into(),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue