Commit Graph

68 Commits

Author SHA1 Message Date
Seiichi Uchida
d512240206 Add tests for #2830 and #2857 2018-07-25 07:13:51 +09:00
Nick Cameron
4fa2969c39 fixup tests 2018-07-24 15:46:39 +12:00
Nick Cameron
90c5792565 Set rustfmt-format_macro_matchers to false by default
cc #2543
2018-07-18 12:09:50 +12:00
topecongiro
6dd7d5ba1c Add a test for #2727 2018-05-24 00:13:56 +09:00
topecongiro
121f5e4e42 Add an test for #2652 2018-04-28 15:09:36 +09:00
Seiichi Uchida
e58e97783e Preserve trailing comma on macro call when using mixed layout 2018-04-12 09:54:00 +09:00
Seiichi Uchida
a43ac40a78 Add tests for #2588 2018-04-05 12:52:43 +09:00
Ryan Leung
2c7e737a06 add tests for macro!(/* comment */) (#2592)
* add tests
2018-04-04 11:02:01 +09:00
Ivan Sorokin
e6423cf4b1 Add test #2574 (#2577) 2018-04-01 00:54:44 +09:00
Seiichi Uchida
a49e00b4d7 Avoid panicking on macro call with a single comma
`parse_item` from libsyntax may return `None`, so we need to discard
the result in that case.
2018-03-28 18:14:51 +09:00
topecongiro
ccec777f92 Cargo fmt and update tests 2018-03-22 16:09:21 +09:00
Nick Cameron
4f522794ae Tidy up and pass tests 2018-03-02 15:07:13 +13:00
topecongiro
4af2aa3a9e Create rustfmt_core crate 2018-02-07 22:48:05 +09:00
Ingvar Stepanyan
9423cdba82 Omit newline for empty macro branches 2018-02-04 11:53:10 +00:00
Ingvar Stepanyan
9fca9073d9 Revert comments 2018-02-04 11:53:10 +00:00
Ingvar Stepanyan
1b9fd01343 Support compact macros 2.0 representation 2018-02-04 11:53:10 +00:00
Ingvar Stepanyan
9318b4d2cf Update some macro tests 2018-02-04 11:53:10 +00:00
Seiichi Uchida
61b23a4293 Skip rewriting macro def with repeat 2018-02-04 08:52:50 +09:00
Seiichi Uchida
298f29a57d Do not panic when special macros have less args than expected 2018-01-18 00:50:16 +09:00
Nick Cameron
9368de276c
Merge pull request #2327 from nrc/macro-defs
Some macros 2.0 macro defs
2018-01-04 14:02:37 +13:00
Nick Cameron
aa758d671f Better handling of comments in macro defs 2018-01-03 20:36:52 +13:00
Nick Cameron
47d9ccd6a1 Tests for formatting macro 2.0 defs 2018-01-01 19:51:54 +13:00
David Wood
39e2f43f91 Split assert_eq! if any arguments are not simple 2017-12-27 21:19:42 +00:00
David Wood
ef8b2efd13 Fix off-by-one error in assert_eq! line wrapping
If two really long conditions are checked for equality, they wouldn't be split
into multiple lines if the last condition is the one to push the line past the
width limit.

Fix the off-by-one error that caused this, and add a test-case for it.
2017-12-23 01:32:55 +00: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
Seiichi Uchida
0909ecbac7 Add tests for macro in pattern position 2017-12-10 00:21:49 +09:00
David Alber
9a25458179 Adding tests for assert!, write!, and writeln! 2017-12-06 22:42:33 -08:00
David Alber
eb42956e84 Adding print! specially-formatted format!-like macros list
This commit corrects what appears to be an accidental inclusion of
`panic!` twice in the list resulting from the union of ffbe52e and
aeb3398.
2017-12-05 16:56:56 -08:00
David Alber
8c51122f54 Adding tests for all specially-formatted format!-like macros 2017-12-05 16:56:36 -08:00
Seiichi Uchida
289b5f4c21 Update a test 2017-12-05 08:44:26 +09:00
Seiichi Uchida
ab8129069a Add a test for #1209 2017-12-05 08:41:10 +09:00
topecongiro
16184d3e16 Cargo fmt and update a test 2017-12-03 11:34:18 +09:00
topecongiro
72cac8beae Add a test for special case macros like format! and assert! 2017-12-03 11:34:18 +09:00
topecongiro
5aaa00a929 Add a test for #2214 2017-11-30 22:12:55 +09:00
topecongiro
daf4789b76 Add a test for #2087 2017-10-27 16:35:40 +09:00
topecongiro
00f8610d9b Add a test 2017-10-05 19:44:45 +09:00
topecongiro
848d4559e1 Enhance macro rewrite 2017-08-31 13:52:13 +09:00
topecongiro
343b315830 Handle macros with tabs 2017-08-27 13:44:49 +09:00
topecongiro
24efc3a934 Ignore empty lines inside arguments of macro with brace 2017-08-25 22:35:22 +09:00
Seiichi Uchida
a18a40cbc1 Add indent to macro we could not format 2017-08-21 23:19:01 +09:00
topecongiro
2376582dfb Update tests 2017-08-11 17:54:20 +09:00
Seiichi Uchida
a8b0a6e4c5 Format source codes and update tests 2017-07-20 00:42:00 +09:00
topecongiro
a4cce31ea9 Update tests 2017-07-07 09:04:06 +09:00
topecongiro
6a7f866cfe Format source codes 2017-07-05 18:12:43 +09:00
topecongiro
eeb5599b4b Do not add trailing comma inside macro invocation unless there already is 2017-06-23 13:43:43 +09:00
topecongiro
f062544cdd Update tests inside macro.rs
I moved around some tests in order to prevent rustfmt from failing to format
tests after macro invocations whose arguments cannot be parsed as expressions.
2017-06-23 13:03:37 +09:00
Seiichi Uchida
6afb0e856c Avoid line break when rhs of assignment is an invalid macro 2017-06-18 14:25:21 +09:00
topecongiro
b8f11a4e3c Format source codes 2017-06-14 20:39:07 +09:00
Nick Cameron
6f30d9e7c9 Reformat tests 2017-06-13 14:42:54 +12:00
Nick Cameron
b79094262f Merge pull request #1604 from topecongiro/comment-group
Format comments with different opening in different manner
2017-05-30 08:53:22 +12:00