Merge pull request #463 from rust-lang/fix/panic-doesnt-fail-tests
Update lang_tester so that panicking in a test results in the test failing
This commit is contained in:
commit
5178a8d6e8
8
Cargo.lock
generated
8
Cargo.lock
generated
@ -70,9 +70,9 @@ checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764"
|
||||
|
||||
[[package]]
|
||||
name = "fm"
|
||||
version = "0.1.4"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68fda3cff2cce84c19e5dfa5179a4b35d2c0f18b893f108002b8a6a54984acca"
|
||||
checksum = "21bcf4db620a804cf7e9d84fbcb5d4ac83a8c43396203b2507d62ea31814dfd4"
|
||||
dependencies = [
|
||||
"regex",
|
||||
]
|
||||
@ -110,9 +110,9 @@ checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
|
||||
|
||||
[[package]]
|
||||
name = "lang_tester"
|
||||
version = "0.3.13"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96bd995a092cac79868250589869b5a5d656b02a02bd74c8ebdc566dc7203090"
|
||||
checksum = "9af8149dbb3ed7d8e529fcb141fe033b1c26ed54cbffc6762d3a86483c485d23"
|
||||
dependencies = [
|
||||
"fm",
|
||||
"getopts",
|
||||
|
@ -36,7 +36,7 @@ smallvec = { version = "1.6.1", features = ["union", "may_dangle"] }
|
||||
tempfile = "3.7.1"
|
||||
|
||||
[dev-dependencies]
|
||||
lang_tester = "0.3.9"
|
||||
lang_tester = "0.8.0"
|
||||
tempfile = "3.1.0"
|
||||
boml = "0.3.1"
|
||||
|
||||
|
@ -37,8 +37,8 @@ pub fn main_inner(profile: Profile) {
|
||||
.to_string();
|
||||
env::set_var("LD_LIBRARY_PATH", gcc_path);
|
||||
|
||||
fn rust_filter(filename: &Path) -> bool {
|
||||
filename.extension().expect("extension").to_str().expect("to_str") == "rs"
|
||||
fn rust_filter(path: &Path) -> bool {
|
||||
path.is_file() && path.extension().expect("extension").to_str().expect("to_str") == "rs"
|
||||
}
|
||||
|
||||
#[cfg(feature = "master")]
|
||||
@ -58,16 +58,17 @@ pub fn main_inner(profile: Profile) {
|
||||
|
||||
LangTester::new()
|
||||
.test_dir("tests/run")
|
||||
.test_file_filter(filter)
|
||||
.test_extract(|source| {
|
||||
let lines = source
|
||||
.test_path_filter(filter)
|
||||
.test_extract(|path| {
|
||||
let lines = std::fs::read_to_string(path)
|
||||
.expect("read file")
|
||||
.lines()
|
||||
.skip_while(|l| !l.starts_with("//"))
|
||||
.take_while(|l| l.starts_with("//"))
|
||||
.map(|l| &l[2..])
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n");
|
||||
Some(lines)
|
||||
lines
|
||||
})
|
||||
.test_cmds(move |path| {
|
||||
// Test command 1: Compile `x.rs` into `tempdir/x`.
|
||||
|
Loading…
x
Reference in New Issue
Block a user