| 6 | let mut p = CompilationPipeline::new(); |
| 7 | p.set_write_artifacts(false); |
| 8 | let err = p |
| 9 | .compile(src) |
| 10 | .expect_err(&format!("expected compile to fail with '{fragment}'")); |
| 11 | match &err { |
| 12 | CompilationError::DiagnosticErrors(diags) => assert!( |
| 13 | diags.iter().any(|d| d.message.contains(fragment)), |
| 14 | "expected diagnostic containing `{fragment}`\ngot: {diags:?}" |
| 15 | ), |
| 16 | other => panic!("expected DiagnosticErrors, got: {other:?}"), |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | fn accept(src: &str) { |
| 21 | let mut p = CompilationPipeline::new(); |
| 22 | p.set_write_artifacts(false); |
| 23 | p.compile(src) |
| 24 | .unwrap_or_else(|e| panic!("expected compile to succeed, got: {e}")); |