Debian Codegraph @

tests/trybuild.rs

raw symbols SCIP
1 fn main() {
2 let args: Vec<_> = std::env::args().collect();
3 let t = trybuild::TestCases::new();
4
5 t.pass("tests/run-pass/*.rs");
6
7 let expected_rust_ver = env!("CARGO_PKG_RUST_VERSION");
8 let run_anyway = args.iter().any(|a| a == "--compile-fail");
9
10 let run_compile_fail = run_anyway || version_check::is_exact_version(expected_rust_ver).unwrap_or(true);
11 if run_compile_fail {
12 t.compile_fail("tests/compile-fail/*.rs");
13 }
14
15 // Trybuild runs the configured tests on drop
16 drop(t);
17
18 if !run_compile_fail {
19 eprintln!("!!! Skipped compile-fail tests !!!");
20 eprintln!("These tests are only checked on rust version {expected_rust_ver} because");
21 eprintln!("the error message text may change between compiler versions.");
22 eprintln!("");
23 eprintln!("Run `cargo +{expected_rust_ver} test` to run these tests.");
24 eprintln!("");
25 }
26 }