Skip to content

Commit 5178a8d

Browse files
authored
Merge pull request rust-lang#463 from rust-lang/fix/panic-doesnt-fail-tests
Update lang_tester so that panicking in a test results in the test failing
2 parents bf5770a + 4baadb7 commit 5178a8d

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

Cargo.lock

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ smallvec = { version = "1.6.1", features = ["union", "may_dangle"] }
3636
tempfile = "3.7.1"
3737

3838
[dev-dependencies]
39-
lang_tester = "0.3.9"
39+
lang_tester = "0.8.0"
4040
tempfile = "3.1.0"
4141
boml = "0.3.1"
4242

tests/lang_tests_common.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ pub fn main_inner(profile: Profile) {
3737
.to_string();
3838
env::set_var("LD_LIBRARY_PATH", gcc_path);
3939

40-
fn rust_filter(filename: &Path) -> bool {
41-
filename.extension().expect("extension").to_str().expect("to_str") == "rs"
40+
fn rust_filter(path: &Path) -> bool {
41+
path.is_file() && path.extension().expect("extension").to_str().expect("to_str") == "rs"
4242
}
4343

4444
#[cfg(feature = "master")]
@@ -58,16 +58,17 @@ pub fn main_inner(profile: Profile) {
5858

5959
LangTester::new()
6060
.test_dir("tests/run")
61-
.test_file_filter(filter)
62-
.test_extract(|source| {
63-
let lines = source
61+
.test_path_filter(filter)
62+
.test_extract(|path| {
63+
let lines = std::fs::read_to_string(path)
64+
.expect("read file")
6465
.lines()
6566
.skip_while(|l| !l.starts_with("//"))
6667
.take_while(|l| l.starts_with("//"))
6768
.map(|l| &l[2..])
6869
.collect::<Vec<_>>()
6970
.join("\n");
70-
Some(lines)
71+
lines
7172
})
7273
.test_cmds(move |path| {
7374
// Test command 1: Compile `x.rs` into `tempdir/x`.

0 commit comments

Comments
 (0)