Skip to content

Commit

Permalink
Modify integration tests to fail on panic
Browse files Browse the repository at this point in the history
  • Loading branch information
cjpearce committed Apr 7, 2019
1 parent fbd0ccb commit 3d11d76
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 7 deletions.
3 changes: 3 additions & 0 deletions tests/fixture/failure/compFailure.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
let
}
File renamed without changes.
7 changes: 7 additions & 0 deletions tests/fixture/failure/info.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[[exercises]]
path = "compFailure.rs"
mode = "compile"

[[exercises]]
path = "testFailure.rs"
mode = "test"
4 changes: 4 additions & 0 deletions tests/fixture/failure/testFailure.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#[test]
fn passing() {
asset!(true);
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
44 changes: 37 additions & 7 deletions tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,55 +13,85 @@ fn fails_when_in_wrong_dir() {
.unwrap()
.current_dir("tests/")
.assert()
.failure();
.code(1);
}

#[test]
fn verify_all_success() {
Command::cargo_bin("rustlings")
.unwrap()
.arg("v")
.current_dir("tests/fixture/")
.current_dir("tests/fixture/success")
.assert()
.success();
}

#[test]
fn verify_all_failure() {
Command::cargo_bin("rustlings")
.unwrap()
.arg("v")
.current_dir("tests/fixture/failure")
.assert()
.code(1);
}

#[test]
fn run_single_compile_success() {
Command::cargo_bin("rustlings")
.unwrap()
.args(&["r", "compSuccess.rs"])
.current_dir("tests/fixture/")
.current_dir("tests/fixture/success/")
.assert()
.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]
fn run_single_test_success() {
Command::cargo_bin("rustlings")
.unwrap()
.args(&["r", "testSuccess.rs"])
.current_dir("tests/fixture/")
.current_dir("tests/fixture/success/")
.assert()
.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]
fn run_single_test_no_filename() {
Command::cargo_bin("rustlings")
.unwrap()
.arg("r")
.current_dir("tests/fixture/")
.assert()
.failure();
.code(1);
}

#[test]
fn run_single_test_no_exercise() {
Command::cargo_bin("rustlings")
.unwrap()
.args(&["r", "compNoExercise.rs"])
.current_dir("tests/fixture/")
.current_dir("tests/fixture/failure")
.assert()
.failure();
.code(1);
}

0 comments on commit 3d11d76

Please sign in to comment.