Commit Graph

539 Commits

Author SHA1 Message Date
bors
1f07fd4150 Auto merge of #163 - briankung:add_structs, r=komaeda
Adds a simple exercise for structures

Thanks for rustlings! Here's a small contribution in return.
2019-05-25 13:40:15 +00:00
Brian Kung
9b92aa08ae Adds a simple exercise for structures 2019-05-25 06:39:58 -05:00
bors
8bf8cbbd61 Auto merge of #162 - c-rustacean:rustfmt-and-ws-fixes, r=komaeda
errorsn.rs: Separate also the hints from each other to avoid accidental viewing
2019-05-23 11:01:15 +00:00
Eddy Petrisor
f507844102 errorsn.rs: Separate also the hints from each other to avoid accidental viewing
Signed-off-by: Eddy Petrisor <eddy.petrisor@gmail.com>
2019-05-23 12:21:42 +03:00
bors
fffbb60ed9 Auto merge of #161 - c-rustacean:rustfmt-and-ws-fixes, r=komaeda
Rustfmt and ws fixes
2019-05-22 12:29:20 +00:00
Eddy Petrisor
9aec4abc4d rustfmt the exercises
Signed-off-by: Eddy Petrisor <eddy.petrisor@gmail.com>
2019-05-22 14:50:40 +03:00
Eddy Petrisor
a53b3f199f iterator3.rs: whitespace fixes
Signed-off-by: Eddy Petrisor <eddy.petrisor@gmail.com>
2019-05-22 14:50:40 +03:00
Eddy Petrisor
d6d696b66a errorsn.rs: Separate hints from code, so hints are not accidentally seen
Signed-off-by: Eddy Petrisor <eddy.petrisor@gmail.com>
2019-05-22 14:50:39 +03:00
Eddy Petrisor
ca6bf966dd Cargo fmt the rustlings application code
Signed-off-by: Eddy Petrisor <eddy.petrisor@gmail.com>
2019-05-22 14:50:23 +03:00
liv
5a9f8860ca
Add not passing integration test (#154)
Add not passing integration test
2019-05-22 10:53:46 +02:00
liv
5423bc66a9
Update errors1.rs - Add Result type signature as it is difficult for new comers to understand Generics and Error all at once. (#157)
Update errors1.rs - Add Result type signature as it is difficult for new comers to understand Generics and Error all at once.
2019-05-22 10:53:18 +02:00
Julien Bisconti
187d2ad226
Update errors1.rs
Add Result type signature as it is difficult for new comers to understand Generics and Error all at once
2019-05-12 14:54:37 +02:00
Denys Smirnov
7cf0d5d15e Add not passing integration test 2019-05-09 20:17:38 +03:00
liv
1f2ee8cb62 1.2.2 2019-05-07 12:32:50 +02:00
liv
35c3d0b3fc Revert --nocapture flag
This closes #149 and #152
2019-05-07 12:31:02 +02:00
liv
0279294972 1.2.1 2019-04-22 19:12:30 +08:00
liv
7eddee6f7a add a slightly more helpful error message 2019-04-22 18:43:39 +08:00
liv
f2c48cfac5 fix the --nocapture functionality 2019-04-22 18:42:32 +08:00
liv
6ae0a00211 1.2.0 2019-04-22 13:09:28 +08:00
liv
bfcf38c8bc
damn it 2019-04-22 07:05:46 +02:00
liv
9e328da641
use -- --nocapture when testing 2019-04-22 05:49:23 +02:00
bors
e336d04c79 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!
2019-04-22 01:50:48 +00:00
Yvan Sraka
a71bc62c29
Add errors to exercises that compile without user changes 2019-04-22 00:09:30 +02:00
liv
4b0b7093e5 1.1.1 2019-04-14 18:29:32 +02:00
bors
8387de64d3 Auto merge of #143 - cjpearce:fix-exercise-path-matching, r=komaeda
Canonicalize paths to fix path matching

This PR should fix #126. The main solution to the issue was using `canonicalize()` on the paths we create for the exercises from `info.toml` and any user-specified paths, so that path `ends_with` matching will work correctly.

As adding calls to the canonicalize function everywhere requires unwrapping, I also decided to extract a struct representing an exercise and use serde to deserialize the paths from the `info.toml` file up front. I also tried to move the path handling out into the `exercise.rs` file and down into `main.rs` so that it doesn't create as much clutter. There was already a lot of unwrapping and path handling in the other files and I felt like it was getting a bit too repetitive.

If the approach is going too far (too many changes etc.) I'm happy to try to produce a smaller PR that fixes the bug without any refactoring.
2019-04-13 16:32:02 +00:00
Chris Pearce
77de6e5d6a Clean up test includes for File and Path 2019-04-12 23:14:15 +01:00
Chris Pearce
8c867a001a Remove unwrap on canonicalize result 2019-04-12 22:24:13 +01:00
Chris Pearce
d01a71f7de Extract exercise struct to encapsulate path logic 2019-04-12 08:58:25 +01:00
bors
04d1d4c00e Auto merge of #142 - diodfr:patch-1, r=komaeda
Fix links by deleting book version
2019-04-08 20:05:34 +00:00
Diod FR
d7e58ee1af
Fix links by deleting book version 2019-04-08 22:02:04 +02:00
bors
ffb165ce26 Auto merge of #140 - cjpearce:fix/test-race-condition, r=komaeda
Fix intermittent test failure caused by race condition

First public pull request 😬

There's an intermittent integration test failure when you use multiple test threads (at least for me on a mac). I narrowed it down to two tests each spawning a process using `Command` which then try to compile the same file at the same time. If the timing doesn't work out, they both try to compile, and then one process runs `clean` before the other can run the executable - causing a panic.

![Screenshot 2019-04-07 at 19 54 55](https://user-images.githubusercontent.com/3453268/55688324-20520980-596f-11e9-8474-5215d61a4387.png)

You can prevent it from happening by running with a single thread (`cargo test -- --test-threads=1`), because the `Command` blocks. That's not a particularly good solution though because it's not something you can configure in `Cargo.toml`.

I considered making the affected tests just run serially, but it occurred to me that this could also happen if someone accidentally runs rustlings in watch mode in two terminals without realising it. I wound't consider this that unlikely given it's a tool for learning.

I fixed it by ensuring that the executables made from separate processes don't conflict by appending a process id to the output executable name. I also extracted the commands into a single file next to `clean` so that we don't have to repeat the generated file name everywhere and risk missing something.
2019-04-07 22:37:34 +00:00
Chris Pearce
65cb09eb2e Update ci test command to allow multithreaded tests 2019-04-07 21:23:02 +01:00
bors
78552ebd7a Auto merge of #141 - cjpearce:fix/run-panics-on-compile-fail, r=komaeda
Stop run from panicking when compile fails

Currently if you use the `rustlings run` command and your program fails to compile, rustlings will panic while trying to exit.

First I've added a couple of integration tests to cover this case, which also meant moving a few tests so that the new fixtures didn't cause `verify_all_success` to fail.

Then I noticed that the existing integration tests that test for failure pass even when rustlings panics, preventing the new tests from failing. I've updated the integration tests to distinguish between when rustlings has failed in the way that we want (exit code 1) rather than a panic (exit code 101).

Finally I fixed the actual panic, which was just caused by unwrapping when rustlings should probably be exiting cleanly.
2019-04-07 20:11:22 +00:00
Chris Pearce
0c7bd12372 Fix test failing due to panic 2019-04-07 20:13:04 +01:00
Chris Pearce
3d11d7685b Modify integration tests to fail on panic 2019-04-07 20:13:04 +01:00
Chris Pearce
592ae6b4d2 Add process id to temp file name 2019-04-07 17:28:51 +01:00
Chris Pearce
4fa79ee02f Extract command builders into util 2019-04-07 17:26:01 +01:00
bors
fbd0ccbd5b Auto merge of #134 - rust-lang:fix/windows-paths, r=komaeda
fix watch command path execution

@hades32 @guttume could you test whether this works on windows by checking out the branch locally and running `cargo run watch`?
2019-04-03 09:37:37 +00:00
komaeda
8c008a0e7d
Merge pull request #137 from mgeier/patch-1
Fix order of true/false in tests for executables
2019-03-28 12:11:35 +01:00
Matthias Geier
11fe19d08a
Fix order of true/false in tests for executables
1b3469f236 has fixed the tests themselves, but now the original error shows itself.
2019-03-28 11:53:29 +01:00
liv
1b3469f236 make installation command checks more thorough 2019-03-28 10:51:54 +01:00
liv
022921168d fix watch command path execution 2019-03-27 10:58:56 +01:00
komaeda
c6765eb3eb
Merge pull request #133 from zacanger/bug/permissions
Fix permissions on exercise files
2019-03-24 15:44:34 +01:00
zacanger
c5a374fbf2
Fix permissions on source files 2019-03-23 14:19:42 -06:00
lyn
f3ee70489f 1.1.0 2019-03-20 21:27:27 +01:00
lyn
6a27ba735c cargo fmt 2019-03-20 21:25:45 +01:00
komaeda
91dce31265
Merge pull request #131 from ColinPitrat/master
Verify that rust version is recent enough to install rustlings.
2019-03-20 21:22:04 +01:00
lyn
040ca18a64 add travis config 2019-03-20 21:08:08 +01:00
lyn
f43cb124f6 add tests 2019-03-20 21:05:45 +01:00
komaeda
11875aed6e
adjust author name 2019-03-20 14:51:28 +01:00