Modify integration tests to fail on panic
This commit is contained in:
parent
fbd0ccbd5b
commit
3d11d7685b
3
tests/fixture/failure/compFailure.rs
Normal file
3
tests/fixture/failure/compFailure.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fn main() {
|
||||||
|
let
|
||||||
|
}
|
7
tests/fixture/failure/info.toml
Normal file
7
tests/fixture/failure/info.toml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[[exercises]]
|
||||||
|
path = "compFailure.rs"
|
||||||
|
mode = "compile"
|
||||||
|
|
||||||
|
[[exercises]]
|
||||||
|
path = "testFailure.rs"
|
||||||
|
mode = "test"
|
4
tests/fixture/failure/testFailure.rs
Normal file
4
tests/fixture/failure/testFailure.rs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#[test]
|
||||||
|
fn passing() {
|
||||||
|
asset!(true);
|
||||||
|
}
|
@ -13,7 +13,7 @@ fn fails_when_in_wrong_dir() {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.current_dir("tests/")
|
.current_dir("tests/")
|
||||||
.assert()
|
.assert()
|
||||||
.failure();
|
.code(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -21,31 +21,61 @@ fn verify_all_success() {
|
|||||||
Command::cargo_bin("rustlings")
|
Command::cargo_bin("rustlings")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.arg("v")
|
.arg("v")
|
||||||
.current_dir("tests/fixture/")
|
.current_dir("tests/fixture/success")
|
||||||
.assert()
|
.assert()
|
||||||
.success();
|
.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn verify_all_failure() {
|
||||||
|
Command::cargo_bin("rustlings")
|
||||||
|
.unwrap()
|
||||||
|
.arg("v")
|
||||||
|
.current_dir("tests/fixture/failure")
|
||||||
|
.assert()
|
||||||
|
.code(1);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn run_single_compile_success() {
|
fn run_single_compile_success() {
|
||||||
Command::cargo_bin("rustlings")
|
Command::cargo_bin("rustlings")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.args(&["r", "compSuccess.rs"])
|
.args(&["r", "compSuccess.rs"])
|
||||||
.current_dir("tests/fixture/")
|
.current_dir("tests/fixture/success/")
|
||||||
.assert()
|
.assert()
|
||||||
.success();
|
.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn run_single_compile_failure() {
|
||||||
|
Command::cargo_bin("rustlings")
|
||||||
|
.unwrap()
|
||||||
|
.args(&["r", "compFailure.rs"])
|
||||||
|
.current_dir("tests/fixture/failure/")
|
||||||
|
.assert()
|
||||||
|
.code(1);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn run_single_test_success() {
|
fn run_single_test_success() {
|
||||||
Command::cargo_bin("rustlings")
|
Command::cargo_bin("rustlings")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.args(&["r", "testSuccess.rs"])
|
.args(&["r", "testSuccess.rs"])
|
||||||
.current_dir("tests/fixture/")
|
.current_dir("tests/fixture/success/")
|
||||||
.assert()
|
.assert()
|
||||||
.success();
|
.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn run_single_test_failure() {
|
||||||
|
Command::cargo_bin("rustlings")
|
||||||
|
.unwrap()
|
||||||
|
.args(&["r", "testFailure.rs"])
|
||||||
|
.current_dir("tests/fixture/failure/")
|
||||||
|
.assert()
|
||||||
|
.code(1);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn run_single_test_no_filename() {
|
fn run_single_test_no_filename() {
|
||||||
Command::cargo_bin("rustlings")
|
Command::cargo_bin("rustlings")
|
||||||
@ -53,7 +83,7 @@ fn run_single_test_no_filename() {
|
|||||||
.arg("r")
|
.arg("r")
|
||||||
.current_dir("tests/fixture/")
|
.current_dir("tests/fixture/")
|
||||||
.assert()
|
.assert()
|
||||||
.failure();
|
.code(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -61,7 +91,7 @@ fn run_single_test_no_exercise() {
|
|||||||
Command::cargo_bin("rustlings")
|
Command::cargo_bin("rustlings")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.args(&["r", "compNoExercise.rs"])
|
.args(&["r", "compNoExercise.rs"])
|
||||||
.current_dir("tests/fixture/")
|
.current_dir("tests/fixture/failure")
|
||||||
.assert()
|
.assert()
|
||||||
.failure();
|
.code(1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user