-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'kevinmehall:master' into patch-unstable-vectors
- Loading branch information
Showing
6 changed files
with
41 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,26 @@ | ||
extern crate trybuild; | ||
|
||
fn main() { | ||
let args: Vec<_> = std::env::args().collect(); | ||
let t = trybuild::TestCases::new(); | ||
|
||
let rust_ver = option_env!("TRAVIS_RUST_VERSION"); | ||
if rust_ver.is_none() { | ||
println!( | ||
"Note: compile-fail tests are normally only tested on the stable rust compiler in CI." | ||
); | ||
} | ||
t.pass("tests/run-pass/*.rs"); | ||
|
||
let expected_rust_ver = env!("CARGO_PKG_RUST_VERSION"); | ||
let run_anyway = args.iter().any(|a| a == "--compile-fail"); | ||
|
||
if rust_ver.is_none() || rust_ver == Some("stable") { | ||
let run_compile_fail = run_anyway || version_check::is_exact_version(expected_rust_ver).unwrap_or(true); | ||
if run_compile_fail { | ||
t.compile_fail("tests/compile-fail/*.rs"); | ||
} else { | ||
println!("Skipping compile-fail tests."); | ||
} | ||
|
||
t.pass("tests/run-pass/*.rs"); | ||
// Trybuild runs the configured tests on drop | ||
drop(t); | ||
|
||
if !run_compile_fail { | ||
eprintln!("!!! Skipped compile-fail tests !!!"); | ||
eprintln!("These tests are only checked on rust version {expected_rust_ver} because"); | ||
eprintln!("the error message text may change between compiler versions."); | ||
eprintln!(""); | ||
eprintln!("Run `cargo +{expected_rust_ver} test` to run these tests."); | ||
eprintln!(""); | ||
} | ||
} |