Commit Graph

97 Commits

Author SHA1 Message Date
Nick Cameron
e52b383a57
Merge pull request #2306 from dtwood/assert-eq-on-one-line
Add assert_eq! to special-cased macros
2018-01-04 13:42:24 +13:00
David Alber
8b4e9df915 Updating error message 2017-12-28 10:29:48 -08:00
David Alber
72dc52ec2c Testing that config option tests use the expected config option 2017-12-28 10:29:48 -08:00
Seiichi Uchida
5160b49e67
Merge pull request #2308 from davidalber/recursive-test-files
Adding ability to recursively find test files
2017-12-27 19:16:01 +09:00
David Alber
65a48da02d Updating error message 2017-12-24 13:31:46 -08:00
Seiichi Uchida
4604fea0a0 Refactoring
1. Cargo clippy
2. Run 'cargo fmt' with import reordering options set to `true`.
3. Factor out `rewrite_lifetime_param()`.
2017-12-25 00:13:59 +09:00
David Alber
9405e05d83 Adding ability to recursively find test files
Part of #1492.
2017-12-23 11:40:37 -08:00
David Wood
e343521276 Add assert_eq! to special-cased macros
Allows for this form of assert_eq! macros:
```rust
assert_eq!(
    left.id, right.id,
    "IDs are not equal: {:?} {:?}",
    left, right
);
```

Also allows for assert! macros to have the format arguments split across
multiple lines even if the assert condition is not simple:
```rust
assert!(
    result >= 42,
    "The result must be at least 42: {:?}",
    result, result.code, context
);
```
2017-12-23 01:06:17 +00:00
David Alber
fa0a63989e Using if let to be more concise 2017-12-18 01:03:12 -08:00
David Alber
54067a7466 Reporting test parse errors as test failures
Fixes 2078.
2017-12-17 16:50:09 -08:00
Oliver Schneider
fad903fd14 Move from String to PathBuf where applicable 2017-12-15 10:26:19 +09:00
Seiichi Uchida
39a304f529 Update tests 2017-12-05 17:16:04 +09:00
clippered
d2f2f25463 add cli option for color 2017-11-13 20:18:03 +11:00
topecongiro
b17de6228f Cargo fmt 2017-11-02 21:45:00 +09:00
Shohei Wada
fe1619b548 Fix the test framework is failing in CRLF env 2017-10-07 01:53:55 +09:00
opilarium
72a9ad6199 Remove unused import 2017-09-21 22:54:29 +03:00
Nick Cameron
bdf791a174 Comment out stdin_disable_all_formatting_test 2017-09-21 20:06:44 +12:00
topecongiro
0779962a6e Add debug logging 2017-09-19 13:46:13 +09:00
topecongiro
007c673012 Remove noisy print from test 2017-09-19 11:02:21 +09:00
topecongiro
75a36f2886 Add a test for 'disable_all_formatting = true' with stdin 2017-09-18 14:19:50 +09:00
Seiichi Uchida
4b79055a15 Apply refactoring from cargo clippy 2017-08-31 12:49:12 +09:00
Seiichi Uchida
404e2db046 Remove unused extern crate 2017-08-28 23:43:49 +09:00
topecongiro
c28df858c7 Format source codes and update tests 2017-08-09 00:16:35 +09:00
Seiichi Uchida
a8b0a6e4c5 Format source codes and update tests 2017-07-20 00:42:00 +09:00
topecongiro
3bf66436e7 Update tests 2017-07-13 18:43:35 +09:00
Andy Russell
86d48981ee
assert no errors on formatting test source
Fixes #28.
2017-07-12 13:21:36 -04:00
topecongiro
cb48435ff3 Format source codes 2017-07-05 18:31:37 +09:00
topecongiro
208ff15954 Format source codes 2017-06-16 08:49:49 +09:00
Robin Stocker
a13db07b03 Add back cargo-fmt binary (#1670)
When there are no `[[bin]]` sections, all the binaries in `src/bin` are
automatically picked up. When a section is added, that is no longer the
case, so all the binaries need to be specified explicitly.
2017-06-14 14:16:51 +10:00
Nick Cameron
6f30d9e7c9 Reformat tests 2017-06-13 14:42:54 +12:00
topecongiro
62d200d9cf Update tests 2017-06-04 19:35:29 +09:00
topecongiro
86856491bc Format source codes 2017-05-25 16:08:08 +09:00
topecongiro
04bb5d8929 Format source codes 2017-05-24 00:07:02 +09:00
Michael Killough
c3c2e823cb Merge branch 'master' of https://github.com/rust-lang-nursery/rustfmt into config 2017-05-18 13:05:19 +07:00
Michael Killough
222bac1397 Provide config.set().item(value) API.
This API isn't fantastic, but it's the best I can come up with without
something like `concat_idents!()`. There are relatively few places where
config is set, to hopefully the ugliness isn't disastrous.

Change previous occurences of `config.item = value` to this new API,
rather than using `config.override_value()`. Undo the changes to
`override_value()`, as it's no longer important to propogate the error
to the caller. Add a test for the new interface.
2017-05-18 11:42:32 +07:00
topecongiro
d7b6f1199f Format source codes 2017-05-16 23:24:38 +09:00
Michael Killough
c0bdbfa531 Switch to accessing config items via method.
Preparation for #865, which proposes adding a flag which outputs which
config options are used during formatting.

This PR should not make any difference to functionality. A lot of this
was search-and-replace.

Some areas worthy of review/discussion:

 - The method for each config item returns a clone of the underlying
   value. We can't simply return an immutable reference, as lots of
   places in the code expect to be able to pass the returned value as
   `bool` (not `&bool). It would be nice if the `bool` items could
   return a copy, but the more complex types a borrowed reference... but
   unfortunately, I couldn't get the macro to do this.
 - A few places (mostly tests and `src/bin/rustfmt.rs`) were overriding
   config items by modifying the fields of the `Config` struct directly.
   They now use the existing `override_value()` method, which has been
   modified to return a `Result` for use by `src/bin/rustfmt.rs`. This
   benefits of this are that the complex `file_lines` and `write_mode`
   strings are now parsed in one place (`Config.override_value`) instead
   of multiple. The disadvantages are that it moves the compile-time
   checks for config names to become run-time checks.
2017-05-16 15:47:09 +07:00
Vincent Esche
4385b8063d Improve error message for missing source/target test file 2017-05-01 23:34:00 +02:00
topecongiro
02cf515be6 Format source codes 2017-04-24 16:50:11 +09:00
topecongiro
6af0968511 Change return type of 'from_toml' from 'Config' to 'Result<Config>'
Closes #1426.
2017-04-03 13:58:46 +09:00
Nick Cameron
5305bc8436 test fallout 2017-03-28 11:25:59 +13:00
Nick Cameron
91bbe0ff8b Test fallout 2017-03-28 11:01:44 +13:00
Nick Cameron
33b83ae7df Formatting fallout
Also fixes a minor bug when we break a line after `if` and used to leave a trailing space
2017-03-07 09:50:41 +13:00
Igor Gnatenko
3323056893 bump regex to 0.2
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2017-02-26 15:09:31 +01:00
Nick Cameron
db10a0b9b2 Merge pull request #1325 from C4K3/master
Add error_on_line_overflow option
2017-02-23 14:46:24 +13:00
Nick Cameron
a7612cc773 more fallout 2017-02-23 13:15:48 +13:00
Nick Cameron
ba1202f6b3 test fallout 2017-02-23 13:15:48 +13:00
Sebastian Blunt
235f33b230
Make tests fail if rustfmt encounters an error
Previously tests would not fail if they encountered an error such as
LineOverflow or TrailingWhitespace. Making the tests error out will fix
this mismatch between running rustfmt for real and running the tests.

This also modifies all tests that previously contained errors so that
they no longer contain errors (in almost all of the tests this is
accomplished by setting error_on_line_overflow = false).
2017-02-19 19:57:02 +01:00
Fraser Hutchison
aef665aa21 Fixes a few doc typos. 2016-11-03 04:22:16 +00:00
Nick Cameron
e1759ae295 Merge pull request #1123 from juicejitsu/807
Don't emit filename in diff mode, add filename to diff metadata
2016-08-10 21:52:46 +12:00