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