From 6177b6e126852027b689ebab4e0796b2984f987b Mon Sep 17 00:00:00 2001 From: mokou Date: Wed, 21 Apr 2021 14:47:53 +0200 Subject: [PATCH] chore: Fix integration tests --- tests/integration_tests.rs | 67 ++++++++++++++------------------------ 1 file changed, 24 insertions(+), 43 deletions(-) diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 1bd3bf7e..be9af965 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -24,7 +24,7 @@ fn fails_when_in_wrong_dir() { fn verify_all_success() { Command::cargo_bin("rustlings") .unwrap() - .arg("v") + .arg("verify") .current_dir("tests/fixture/success") .assert() .success(); @@ -34,7 +34,7 @@ fn verify_all_success() { fn verify_fails_if_some_fails() { Command::cargo_bin("rustlings") .unwrap() - .arg("v") + .arg("verify") .current_dir("tests/fixture/failure") .assert() .code(1); @@ -44,7 +44,7 @@ fn verify_fails_if_some_fails() { fn run_single_compile_success() { Command::cargo_bin("rustlings") .unwrap() - .args(&["r", "compSuccess"]) + .args(&["run", "compSuccess"]) .current_dir("tests/fixture/success/") .assert() .success(); @@ -54,7 +54,7 @@ fn run_single_compile_success() { fn run_single_compile_failure() { Command::cargo_bin("rustlings") .unwrap() - .args(&["r", "compFailure"]) + .args(&["run", "compFailure"]) .current_dir("tests/fixture/failure/") .assert() .code(1); @@ -64,7 +64,7 @@ fn run_single_compile_failure() { fn run_single_test_success() { Command::cargo_bin("rustlings") .unwrap() - .args(&["r", "testSuccess"]) + .args(&["run", "testSuccess"]) .current_dir("tests/fixture/success/") .assert() .success(); @@ -74,7 +74,7 @@ fn run_single_test_success() { fn run_single_test_failure() { Command::cargo_bin("rustlings") .unwrap() - .args(&["r", "testFailure"]) + .args(&["run", "testFailure"]) .current_dir("tests/fixture/failure/") .assert() .code(1); @@ -84,7 +84,7 @@ fn run_single_test_failure() { fn run_single_test_not_passed() { Command::cargo_bin("rustlings") .unwrap() - .args(&["r", "testNotPassed.rs"]) + .args(&["run", "testNotPassed.rs"]) .current_dir("tests/fixture/failure/") .assert() .code(1); @@ -94,7 +94,7 @@ fn run_single_test_not_passed() { fn run_single_test_no_filename() { Command::cargo_bin("rustlings") .unwrap() - .arg("r") + .arg("run") .current_dir("tests/fixture/") .assert() .code(1); @@ -104,7 +104,7 @@ fn run_single_test_no_filename() { fn run_single_test_no_exercise() { Command::cargo_bin("rustlings") .unwrap() - .args(&["r", "compNoExercise.rs"]) + .args(&["run", "compNoExercise.rs"]) .current_dir("tests/fixture/failure") .assert() .code(1); @@ -114,7 +114,7 @@ fn run_single_test_no_exercise() { fn get_hint_for_single_test() { Command::cargo_bin("rustlings") .unwrap() - .args(&["h", "testFailure"]) + .args(&["hint", "testFailure"]) .current_dir("tests/fixture/failure") .assert() .code(0) @@ -131,10 +131,15 @@ fn all_exercises_require_confirmation() { file.read_to_string(&mut s).unwrap(); s }; - source.matches("// I AM NOT DONE").next().unwrap_or_else(|| panic!( - "There should be an `I AM NOT DONE` annotation in {:?}", - path - )); + source + .matches("// I AM NOT DONE") + .next() + .unwrap_or_else(|| { + panic!( + "There should be an `I AM NOT DONE` annotation in {:?}", + path + ) + }); } } @@ -142,7 +147,7 @@ fn all_exercises_require_confirmation() { fn run_compile_exercise_does_not_prompt() { Command::cargo_bin("rustlings") .unwrap() - .args(&["r", "pending_exercise"]) + .args(&["run", "pending_exercise"]) .current_dir("tests/fixture/state") .assert() .code(0) @@ -153,7 +158,7 @@ fn run_compile_exercise_does_not_prompt() { fn run_test_exercise_does_not_prompt() { Command::cargo_bin("rustlings") .unwrap() - .args(&["r", "pending_test_exercise"]) + .args(&["run", "pending_test_exercise"]) .current_dir("tests/fixture/state") .assert() .code(0) @@ -164,7 +169,7 @@ fn run_test_exercise_does_not_prompt() { fn run_single_test_success_with_output() { Command::cargo_bin("rustlings") .unwrap() - .args(&["--nocapture", "r", "testSuccess"]) + .args(&["--nocapture", "run", "testSuccess"]) .current_dir("tests/fixture/success/") .assert() .code(0) @@ -175,7 +180,7 @@ fn run_single_test_success_with_output() { fn run_single_test_success_without_output() { Command::cargo_bin("rustlings") .unwrap() - .args(&["r", "testSuccess"]) + .args(&["run", "testSuccess"]) .current_dir("tests/fixture/success/") .assert() .code(0) @@ -192,26 +197,6 @@ fn run_rustlings_list() { .success(); } -#[test] -fn run_rustlings_list_conflicting_display_options() { - Command::cargo_bin("rustlings") - .unwrap() - .args(&["list", "--names", "--paths"]) - .current_dir("tests/fixture/success") - .assert() - .failure(); -} - -#[test] -fn run_rustlings_list_conflicting_solve_options() { - Command::cargo_bin("rustlings") - .unwrap() - .args(&["list", "--solved", "--unsolved"]) - .current_dir("tests/fixture/success") - .assert() - .failure(); -} - #[test] fn run_rustlings_list_no_pending() { Command::cargo_bin("rustlings") @@ -231,10 +216,7 @@ fn run_rustlings_list_both_done_and_pending() { .current_dir("tests/fixture/state") .assert() .success() - .stdout( - predicates::str::contains("Done") - .and(predicates::str::contains("Pending")) - ); + .stdout(predicates::str::contains("Done").and(predicates::str::contains("Pending"))); } #[test] @@ -258,4 +240,3 @@ fn run_rustlings_list_without_done() { .success() .stdout(predicates::str::contains("Done").not()); } -