Skip to content

Commit 6177b6e

Browse files
committed
chore: Fix integration tests
1 parent 7928122 commit 6177b6e

File tree

1 file changed

+24
-43
lines changed

1 file changed

+24
-43
lines changed

tests/integration_tests.rs

Lines changed: 24 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn fails_when_in_wrong_dir() {
2424
fn verify_all_success() {
2525
Command::cargo_bin("rustlings")
2626
.unwrap()
27-
.arg("v")
27+
.arg("verify")
2828
.current_dir("tests/fixture/success")
2929
.assert()
3030
.success();
@@ -34,7 +34,7 @@ fn verify_all_success() {
3434
fn verify_fails_if_some_fails() {
3535
Command::cargo_bin("rustlings")
3636
.unwrap()
37-
.arg("v")
37+
.arg("verify")
3838
.current_dir("tests/fixture/failure")
3939
.assert()
4040
.code(1);
@@ -44,7 +44,7 @@ fn verify_fails_if_some_fails() {
4444
fn run_single_compile_success() {
4545
Command::cargo_bin("rustlings")
4646
.unwrap()
47-
.args(&["r", "compSuccess"])
47+
.args(&["run", "compSuccess"])
4848
.current_dir("tests/fixture/success/")
4949
.assert()
5050
.success();
@@ -54,7 +54,7 @@ fn run_single_compile_success() {
5454
fn run_single_compile_failure() {
5555
Command::cargo_bin("rustlings")
5656
.unwrap()
57-
.args(&["r", "compFailure"])
57+
.args(&["run", "compFailure"])
5858
.current_dir("tests/fixture/failure/")
5959
.assert()
6060
.code(1);
@@ -64,7 +64,7 @@ fn run_single_compile_failure() {
6464
fn run_single_test_success() {
6565
Command::cargo_bin("rustlings")
6666
.unwrap()
67-
.args(&["r", "testSuccess"])
67+
.args(&["run", "testSuccess"])
6868
.current_dir("tests/fixture/success/")
6969
.assert()
7070
.success();
@@ -74,7 +74,7 @@ fn run_single_test_success() {
7474
fn run_single_test_failure() {
7575
Command::cargo_bin("rustlings")
7676
.unwrap()
77-
.args(&["r", "testFailure"])
77+
.args(&["run", "testFailure"])
7878
.current_dir("tests/fixture/failure/")
7979
.assert()
8080
.code(1);
@@ -84,7 +84,7 @@ fn run_single_test_failure() {
8484
fn run_single_test_not_passed() {
8585
Command::cargo_bin("rustlings")
8686
.unwrap()
87-
.args(&["r", "testNotPassed.rs"])
87+
.args(&["run", "testNotPassed.rs"])
8888
.current_dir("tests/fixture/failure/")
8989
.assert()
9090
.code(1);
@@ -94,7 +94,7 @@ fn run_single_test_not_passed() {
9494
fn run_single_test_no_filename() {
9595
Command::cargo_bin("rustlings")
9696
.unwrap()
97-
.arg("r")
97+
.arg("run")
9898
.current_dir("tests/fixture/")
9999
.assert()
100100
.code(1);
@@ -104,7 +104,7 @@ fn run_single_test_no_filename() {
104104
fn run_single_test_no_exercise() {
105105
Command::cargo_bin("rustlings")
106106
.unwrap()
107-
.args(&["r", "compNoExercise.rs"])
107+
.args(&["run", "compNoExercise.rs"])
108108
.current_dir("tests/fixture/failure")
109109
.assert()
110110
.code(1);
@@ -114,7 +114,7 @@ fn run_single_test_no_exercise() {
114114
fn get_hint_for_single_test() {
115115
Command::cargo_bin("rustlings")
116116
.unwrap()
117-
.args(&["h", "testFailure"])
117+
.args(&["hint", "testFailure"])
118118
.current_dir("tests/fixture/failure")
119119
.assert()
120120
.code(0)
@@ -131,18 +131,23 @@ fn all_exercises_require_confirmation() {
131131
file.read_to_string(&mut s).unwrap();
132132
s
133133
};
134-
source.matches("// I AM NOT DONE").next().unwrap_or_else(|| panic!(
135-
"There should be an `I AM NOT DONE` annotation in {:?}",
136-
path
137-
));
134+
source
135+
.matches("// I AM NOT DONE")
136+
.next()
137+
.unwrap_or_else(|| {
138+
panic!(
139+
"There should be an `I AM NOT DONE` annotation in {:?}",
140+
path
141+
)
142+
});
138143
}
139144
}
140145

141146
#[test]
142147
fn run_compile_exercise_does_not_prompt() {
143148
Command::cargo_bin("rustlings")
144149
.unwrap()
145-
.args(&["r", "pending_exercise"])
150+
.args(&["run", "pending_exercise"])
146151
.current_dir("tests/fixture/state")
147152
.assert()
148153
.code(0)
@@ -153,7 +158,7 @@ fn run_compile_exercise_does_not_prompt() {
153158
fn run_test_exercise_does_not_prompt() {
154159
Command::cargo_bin("rustlings")
155160
.unwrap()
156-
.args(&["r", "pending_test_exercise"])
161+
.args(&["run", "pending_test_exercise"])
157162
.current_dir("tests/fixture/state")
158163
.assert()
159164
.code(0)
@@ -164,7 +169,7 @@ fn run_test_exercise_does_not_prompt() {
164169
fn run_single_test_success_with_output() {
165170
Command::cargo_bin("rustlings")
166171
.unwrap()
167-
.args(&["--nocapture", "r", "testSuccess"])
172+
.args(&["--nocapture", "run", "testSuccess"])
168173
.current_dir("tests/fixture/success/")
169174
.assert()
170175
.code(0)
@@ -175,7 +180,7 @@ fn run_single_test_success_with_output() {
175180
fn run_single_test_success_without_output() {
176181
Command::cargo_bin("rustlings")
177182
.unwrap()
178-
.args(&["r", "testSuccess"])
183+
.args(&["run", "testSuccess"])
179184
.current_dir("tests/fixture/success/")
180185
.assert()
181186
.code(0)
@@ -192,26 +197,6 @@ fn run_rustlings_list() {
192197
.success();
193198
}
194199

195-
#[test]
196-
fn run_rustlings_list_conflicting_display_options() {
197-
Command::cargo_bin("rustlings")
198-
.unwrap()
199-
.args(&["list", "--names", "--paths"])
200-
.current_dir("tests/fixture/success")
201-
.assert()
202-
.failure();
203-
}
204-
205-
#[test]
206-
fn run_rustlings_list_conflicting_solve_options() {
207-
Command::cargo_bin("rustlings")
208-
.unwrap()
209-
.args(&["list", "--solved", "--unsolved"])
210-
.current_dir("tests/fixture/success")
211-
.assert()
212-
.failure();
213-
}
214-
215200
#[test]
216201
fn run_rustlings_list_no_pending() {
217202
Command::cargo_bin("rustlings")
@@ -231,10 +216,7 @@ fn run_rustlings_list_both_done_and_pending() {
231216
.current_dir("tests/fixture/state")
232217
.assert()
233218
.success()
234-
.stdout(
235-
predicates::str::contains("Done")
236-
.and(predicates::str::contains("Pending"))
237-
);
219+
.stdout(predicates::str::contains("Done").and(predicates::str::contains("Pending")));
238220
}
239221

240222
#[test]
@@ -258,4 +240,3 @@ fn run_rustlings_list_without_done() {
258240
.success()
259241
.stdout(predicates::str::contains("Done").not());
260242
}
261-

0 commit comments

Comments
 (0)