diff options
| author | bors <bors@rust-lang.org> | 2019-11-11 16:51:12 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-11-11 16:51:12 +0000 |
| commit | 9544ba10294d4959b0a761c04d86ef8ceeba3838 (patch) | |
| tree | dbdd23fad66b796a9fefc04174b50566a7d269a1 /tests | |
| parent | 9a9007abae86c3b1b1c09778a6544ced54ea4453 (diff) | |
| parent | 1a7bb5a4005e66665d2618b20bea132f009b79f9 (diff) | |
Auto merge of #231 - rust-lang:refactor-hints, r=jrvidal
Refactor hints
Breaking change. This removes hints from the end of files, and puts them into `info.toml`. You can now access hints using:
```
rustlings hint <exerciseName>
```
ALSO this changes the exercise system to index by name for `run` and `hint`, so:
```
rustlings run exercises/if/if1.rs
```
becomes
```
rustlings run if1
```
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/fixture/failure/info.toml | 6 | ||||
| -rw-r--r-- | tests/fixture/success/info.toml | 6 | ||||
| -rw-r--r-- | tests/integration_tests.rs | 19 |
3 files changed, 25 insertions, 6 deletions
diff --git a/tests/fixture/failure/info.toml b/tests/fixture/failure/info.toml index f4e7c0c..e5949f9 100644 --- a/tests/fixture/failure/info.toml +++ b/tests/fixture/failure/info.toml @@ -1,7 +1,11 @@ [[exercises]] +name = "compFailure" path = "compFailure.rs" mode = "compile" +hint = "" [[exercises]] +name = "testFailure" path = "testFailure.rs" -mode = "test"
\ No newline at end of file +mode = "test" +hint = "Hello!" diff --git a/tests/fixture/success/info.toml b/tests/fixture/success/info.toml index e255db9..68d3538 100644 --- a/tests/fixture/success/info.toml +++ b/tests/fixture/success/info.toml @@ -1,7 +1,11 @@ [[exercises]] +name = "compSuccess" path = "compSuccess.rs" mode = "compile" +hint = """""" [[exercises]] +name = "testSuccess" path = "testSuccess.rs" -mode = "test"
\ No newline at end of file +mode = "test" +hint = """""" diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 897cd2a..754aa63 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -43,7 +43,7 @@ fn verify_all_failure() { fn run_single_compile_success() { Command::cargo_bin("rustlings") .unwrap() - .args(&["r", "compSuccess.rs"]) + .args(&["r", "compSuccess"]) .current_dir("tests/fixture/success/") .assert() .success(); @@ -53,7 +53,7 @@ fn run_single_compile_success() { fn run_single_compile_failure() { Command::cargo_bin("rustlings") .unwrap() - .args(&["r", "compFailure.rs"]) + .args(&["r", "compFailure"]) .current_dir("tests/fixture/failure/") .assert() .code(1); @@ -63,7 +63,7 @@ fn run_single_compile_failure() { fn run_single_test_success() { Command::cargo_bin("rustlings") .unwrap() - .args(&["r", "testSuccess.rs"]) + .args(&["r", "testSuccess"]) .current_dir("tests/fixture/success/") .assert() .success(); @@ -73,7 +73,7 @@ fn run_single_test_success() { fn run_single_test_failure() { Command::cargo_bin("rustlings") .unwrap() - .args(&["r", "testFailure.rs"]) + .args(&["r", "testFailure"]) .current_dir("tests/fixture/failure/") .assert() .code(1); @@ -110,6 +110,17 @@ fn run_single_test_no_exercise() { } #[test] +fn get_hint_for_single_test() { + Command::cargo_bin("rustlings") + .unwrap() + .args(&["h", "testFailure"]) + .current_dir("tests/fixture/failure") + .assert() + .code(0) + .stdout("Hello!\n"); +} + +#[test] fn all_exercises_require_confirmation() { for exercise in glob("exercises/**/*.rs").unwrap() { let path = exercise.unwrap(); |
