From 84bea05719fef273a04d8fb662ff115ab3abedbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Sun, 15 Oct 2017 14:35:20 +0300 Subject: [PATCH] Add tests --- .../configs-match_arm_forces_newline-true.rs | 20 +++++++++ .../configs-match_arm_forces_newline-true.rs | 44 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 tests/source/configs-match_arm_forces_newline-true.rs create mode 100644 tests/target/configs-match_arm_forces_newline-true.rs diff --git a/tests/source/configs-match_arm_forces_newline-true.rs b/tests/source/configs-match_arm_forces_newline-true.rs new file mode 100644 index 000000000000..e9c8d575f1df --- /dev/null +++ b/tests/source/configs-match_arm_forces_newline-true.rs @@ -0,0 +1,20 @@ +// rustfmt-match_arm_forces_newline: true +// rustfmt-wrap_match_arms: false + +// match_arm_forces_newline puts all match arms bodies in a newline and indents +// them. + +fn main() { + match x() { + // a short non-empty block + X0 => { f(); } + // a long non-empty block + X1 => { some.really.long.expression.fooooooooooooooooooooooooooooooooooooooooo().baaaaarrrrrrrrrrrrrrrrrrrrrrrrrr(); } + // an empty block + X2 => {} + // a short non-block + X3 => println!("ok"), + // a long non-block + X4 => foo.bar.baz.test.x.y.z.a.s.d.fasdfasdf.asfads.fasd.fasdfasdf.dfasfdsaf(), + } +} diff --git a/tests/target/configs-match_arm_forces_newline-true.rs b/tests/target/configs-match_arm_forces_newline-true.rs new file mode 100644 index 000000000000..5629a56d6646 --- /dev/null +++ b/tests/target/configs-match_arm_forces_newline-true.rs @@ -0,0 +1,44 @@ +// rustfmt-match_arm_forces_newline: true +// rustfmt-wrap_match_arms: false + +// match_arm_forces_newline puts all match arms bodies in a newline and indents +// them. + +fn main() { + match x() { + // a short non-empty block + X0 => { + f(); + } + // a long non-empty block + X1 => { + some.really + .long + .expression + .fooooooooooooooooooooooooooooooooooooooooo() + .baaaaarrrrrrrrrrrrrrrrrrrrrrrrrr(); + } + // an empty block + X2 => + {} + // a short non-block + X3 => + println!("ok"), + // a long non-block + X4 => + foo.bar + .baz + .test + .x + .y + .z + .a + .s + .d + .fasdfasdf + .asfads + .fasd + .fasdfasdf + .dfasfdsaf(), + } +}