diff options
| author | bors <bors@rust-lang.org> | 2019-04-22 01:50:48 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-04-22 01:50:48 +0000 |
| commit | e336d04c790e2d93f1a1d702cfeb68eb96744b2d (patch) | |
| tree | 4fc9e115213cd7e1707548b94e4f90e909f1e7da | |
| parent | 4b0b7093e5e0ba2c4b40509c9cb2541eb3a873fe (diff) | |
| parent | a71bc62c29cebec115700d98a61d618e0c7a83b9 (diff) | |
Auto merge of #144 - yvan-sraka:patch-0, r=komaeda
Add errors to exercises that compile without user changes
Hi !
I played a bit with rustlings, and I felt that some exercises were incorrect because they passed the tests without me needing to edit the files!
This gave me the feeling that the exercise was skiped! Especially when I use `rustlings watch`, it is easy to miss an exercise because the compilation error that is displayed is the one of the next exercise ...
It is easy to identify "broken" exercises with:
```bash
% find exercises -name "*.rs" | xargs -n 1 rustlings run
...
✅ Successfully ran exercises/move_semantics/move_semantics4.rs
✅ Successfully tested exercises/test2.rs
```
My suggestion is to make sure that these files trigger a compilation error by adding a simple syntax error (e.g. with `???` in the code that must change) so that our Rustacean can then play with it!
| -rw-r--r-- | exercises/move_semantics/move_semantics4.rs | 3 | ||||
| -rw-r--r-- | exercises/test2.rs | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/exercises/move_semantics/move_semantics4.rs b/exercises/move_semantics/move_semantics4.rs index 903a330..d47e009 100644 --- a/exercises/move_semantics/move_semantics4.rs +++ b/exercises/move_semantics/move_semantics4.rs @@ -16,7 +16,8 @@ fn main() { } -fn fill_vec(vec: Vec<i32>) -> Vec<i32> { +// `fill_vec()` no longer take `vec: Vec<i32>` as argument +fn fill_vec() -> Vec<i32> { let mut vec = vec; vec.push(22); diff --git a/exercises/test2.rs b/exercises/test2.rs index 249abbc..75a4739 100644 --- a/exercises/test2.rs +++ b/exercises/test2.rs @@ -17,6 +17,11 @@ mod tests { #[test] fn returns_twice_of_positive_numbers() { - assert_eq!(4, 4); + assert_eq!(times_two(4), ???); + } + + #[test] + fn returns_twice_of_negative_numbers() { + // TODO write an assert for `times_two(-4)` } } |
