Skip to content

Commit 9b2fd24

Browse files
committed
test: add tests for FitEntireBody, and make the tests for match_arm_wrapping consistent
1 parent fe54957 commit 9b2fd24

File tree

12 files changed

+156
-28
lines changed

12 files changed

+156
-28
lines changed

tests/source/configs/match_arm_wrapping/always.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ fn main() {
88
println!("{}", sit)
99
}
1010
3000 => panic!(),
11-
4000 => (),
11+
4000 => {
12+
()
13+
}
14+
5000 => this.a_very_long_function_name(foo, bar, bazz, fizz, another_argument, some_more_arguments, which_dont_fit),
1215
ipsum => {
1316
// Some comment
1417
let dolor = ipsum % 2;

tests/source/configs/match_arm_wrapping/default.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,19 @@
33

44
fn main() {
55
match lorem {
6-
true => foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
7-
false => {
6+
1000 => foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
7+
2000 => {
88
println!("{}", sit)
99
}
10+
3000 => panic!(),
11+
4000 => {
12+
()
13+
}
14+
5000 => this.a_very_long_function_name(foo, bar, bazz, fizz, another_argument, some_more_arguments, which_dont_fit),
15+
ipsum => {
16+
// Some comment
17+
let dolor = ipsum % 2;
18+
println!("{}", dolor);
19+
}
1020
}
1121
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// rustfmt-match_arm_wrapping: FitEntireBody
2+
// Wrap match-arms
3+
4+
fn main() {
5+
match lorem {
6+
1000 => foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
7+
2000 => {
8+
println!("{}", sit)
9+
}
10+
3000 => panic!(),
11+
4000 => {
12+
()
13+
}
14+
5000 => this.a_very_long_function_name(foo, bar, bazz, fizz, another_argument, some_more_arguments, which_dont_fit),
15+
ipsum => {
16+
// Some comment
17+
let dolor = ipsum % 2;
18+
println!("{}", dolor);
19+
}
20+
}
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// rustfmt-match_arm_wrapping: FitFirstLine
2+
// Wrap match-arms
3+
4+
fn main() {
5+
match lorem {
6+
1000 => foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
7+
2000 => {
8+
println!("{}", sit)
9+
}
10+
3000 => panic!(),
11+
4000 => {
12+
()
13+
}
14+
5000 => this.a_very_long_function_name(foo, bar, bazz, fizz, another_argument, some_more_arguments, which_dont_fit),
15+
ipsum => {
16+
// Some comment
17+
let dolor = ipsum % 2;
18+
println!("{}", dolor);
19+
}
20+
}
21+
}

tests/source/configs/match_arm_wrapping/no_block_first_line.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/source/configs/match_arm_wrapping/preserve.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ fn main() {
1111
4000 => {
1212
()
1313
}
14+
5000 => this.a_very_long_function_name(foo, bar, bazz, fizz, another_argument, some_more_arguments, which_dont_fit),
1415
ipsum => {
1516
// Some comment
1617
let dolor = ipsum % 2;

tests/target/configs/match_arm_wrapping/always.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ fn main() {
1515
4000 => {
1616
()
1717
}
18+
5000 => {
19+
this.a_very_long_function_name(
20+
foo,
21+
bar,
22+
bazz,
23+
fizz,
24+
another_argument,
25+
some_more_arguments,
26+
which_dont_fit,
27+
)
28+
}
1829
ipsum => {
1930
// Some comment
2031
let dolor = ipsum % 2;

tests/target/configs/match_arm_wrapping/default.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,27 @@
33

44
fn main() {
55
match lorem {
6-
true => {
6+
1000 => {
77
foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
88
}
9-
false => {
9+
2000 => {
1010
println!("{}", sit)
1111
}
12+
3000 => panic!(),
13+
4000 => (),
14+
5000 => this.a_very_long_function_name(
15+
foo,
16+
bar,
17+
bazz,
18+
fizz,
19+
another_argument,
20+
some_more_arguments,
21+
which_dont_fit,
22+
),
23+
ipsum => {
24+
// Some comment
25+
let dolor = ipsum % 2;
26+
println!("{}", dolor);
27+
}
1228
}
1329
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// rustfmt-match_arm_wrapping: FitEntireBody
2+
// Wrap match-arms
3+
4+
fn main() {
5+
match lorem {
6+
1000 => {
7+
foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
8+
}
9+
2000 => {
10+
println!("{}", sit)
11+
}
12+
3000 => panic!(),
13+
4000 => (),
14+
5000 => {
15+
this.a_very_long_function_name(
16+
foo,
17+
bar,
18+
bazz,
19+
fizz,
20+
another_argument,
21+
some_more_arguments,
22+
which_dont_fit,
23+
)
24+
}
25+
ipsum => {
26+
// Some comment
27+
let dolor = ipsum % 2;
28+
println!("{}", dolor);
29+
}
30+
}
31+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// rustfmt-match_arm_wrapping: FitFirstLine
2+
// Wrap match-arms
3+
4+
fn main() {
5+
match lorem {
6+
1000 =>
7+
foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
8+
2000 => {
9+
println!("{}", sit)
10+
}
11+
3000 => panic!(),
12+
4000 => (),
13+
5000 => this.a_very_long_function_name(
14+
foo,
15+
bar,
16+
bazz,
17+
fizz,
18+
another_argument,
19+
some_more_arguments,
20+
which_dont_fit,
21+
),
22+
ipsum => {
23+
// Some comment
24+
let dolor = ipsum % 2;
25+
println!("{}", dolor);
26+
}
27+
}
28+
}

tests/target/configs/match_arm_wrapping/no_block_first_line.rs

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/target/configs/match_arm_wrapping/preserve.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ fn main() {
1313
4000 => {
1414
()
1515
}
16+
5000 => this.a_very_long_function_name(
17+
foo,
18+
bar,
19+
bazz,
20+
fizz,
21+
another_argument,
22+
some_more_arguments,
23+
which_dont_fit,
24+
),
1625
ipsum => {
1726
// Some comment
1827
let dolor = ipsum % 2;

0 commit comments

Comments
 (0)