MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / reject

Function reject

tests/integration/compiler_undefined_var.rs:8–21  ·  view source on GitHub ↗
(src: &str, fragment: &str)

Source from the content-addressed store, hash-verified

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
20fn 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}"));

Calls 2

set_write_artifactsMethod · 0.80
compileMethod · 0.45