Skip to content

Commit 761c540

Browse files
committed
add: test cases
1 parent 77b1e0f commit 761c540

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// rustfmt-wrap_comments: true
2+
3+
// Ensure comment preservation in parenthesis
4+
fn main() {
5+
let (/* */ () | () /* */) = ();
6+
let (/**/ () | () /**/) = ();
7+
let (/*comment*/ () | () /*comment*/) = ();
8+
let (/*multi-line
9+
comment*/ () | () /*multi-line
10+
comment */) = ();
11+
let (/*comment with new line
12+
*/
13+
() | ()
14+
/*comment with new line
15+
*/
16+
) = ();
17+
}
18+
19+
// Ensure proper handling of line comments
20+
fn line_comments() {
21+
let (// Before
22+
()
23+
|
24+
()
25+
// After
26+
) = ();
27+
}
28+
29+
// Ensure proper handling of block comments with new lines
30+
fn block_comments_with_new_lines() {
31+
let (/* Before
32+
* with new line */
33+
()
34+
|
35+
()
36+
/* After
37+
* with new line */
38+
) = ();
39+
}
40+
41+
// Ensure inner pattern is getting formatted properly
42+
// whilst preserving comments in outer parenthesis
43+
fn inner_pat_formatting() {
44+
let (/*comment*/
45+
(
46+
47+
)
48+
49+
50+
| (
51+
52+
)
53+
/*comment*/) = ();
54+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// rustfmt-wrap_comments: true
2+
3+
// Ensure comment preservation in parenthesis
4+
fn main() {
5+
let (/**/ () | () /**/) = ();
6+
let (/**/ () | () /**/) = ();
7+
let (/*comment*/ () | () /*comment*/) = ();
8+
let (/*multi-line
9+
comment*/ () | () /*multi-line
10+
comment */) = ();
11+
let (/*comment with new line
12+
*/
13+
() | ()
14+
/*comment with new line
15+
*/
16+
) = ();
17+
}
18+
19+
// Ensure proper handling of line comments
20+
fn line_comments() {
21+
let (// Before
22+
() | ()
23+
// After
24+
) = ();
25+
}
26+
27+
// Ensure proper handling of block comments with new lines
28+
fn block_comments_with_new_lines() {
29+
let (/* Before
30+
* with new line */
31+
() | ()
32+
/* After
33+
* with new line */
34+
) = ();
35+
}
36+
37+
// Ensure inner pattern is getting formatted properly
38+
// whilst preserving comments in outer parenthesis
39+
fn inner_pat_formatting() {
40+
let (/*comment*/
41+
() | ()
42+
/*comment*/) = ();
43+
}

0 commit comments

Comments
 (0)