]> git.lizzy.rs Git - rust.git/commitdiff
Add test for issue 3987
authorYacin Tmimi <yacintmimi@gmail.com>
Tue, 26 Jul 2022 01:38:09 +0000 (21:38 -0400)
committerCaleb Cartwright <calebcartwright@users.noreply.github.com>
Fri, 29 Jul 2022 00:13:10 +0000 (19:13 -0500)
Closes 3987

It's unclear which commit resolved this issue, but it can no longer be
reproduced.

tests/source/issue-3987/format_macro_bodies_true.rs [new file with mode: 0644]
tests/target/issue-3987/format_macro_bodies_false.rs [new file with mode: 0644]
tests/target/issue-3987/format_macro_bodies_true.rs [new file with mode: 0644]

diff --git a/tests/source/issue-3987/format_macro_bodies_true.rs b/tests/source/issue-3987/format_macro_bodies_true.rs
new file mode 100644 (file)
index 0000000..9af114f
--- /dev/null
@@ -0,0 +1,26 @@
+// rustfmt-format_macro_bodies: true
+
+// with comments
+macro_rules! macros {
+    () => {{
+        Struct {
+            field: (
+                42 + //comment 1
+                42
+                //comment 2
+            ),
+        };
+    }};
+}
+
+// without comments
+macro_rules! macros {
+    () => {{
+        Struct {
+            field: (
+                42 +
+                42
+            ),
+        };
+    }};
+}
diff --git a/tests/target/issue-3987/format_macro_bodies_false.rs b/tests/target/issue-3987/format_macro_bodies_false.rs
new file mode 100644 (file)
index 0000000..1352b76
--- /dev/null
@@ -0,0 +1,26 @@
+// rustfmt-format_macro_bodies: false
+
+// with comments
+macro_rules! macros {
+    () => {{
+        Struct {
+            field: (
+                42 + //comment 1
+                42
+                //comment 2
+            ),
+        };
+    }};
+}
+
+// without comments
+macro_rules! macros {
+    () => {{
+        Struct {
+            field: (
+                42 +
+                42
+            ),
+        };
+    }};
+}
diff --git a/tests/target/issue-3987/format_macro_bodies_true.rs b/tests/target/issue-3987/format_macro_bodies_true.rs
new file mode 100644 (file)
index 0000000..88d5715
--- /dev/null
@@ -0,0 +1,21 @@
+// rustfmt-format_macro_bodies: true
+
+// with comments
+macro_rules! macros {
+    () => {{
+        Struct {
+            field: (
+                42 + //comment 1
+                42
+                //comment 2
+            ),
+        };
+    }};
+}
+
+// without comments
+macro_rules! macros {
+    () => {{
+        Struct { field: (42 + 42) };
+    }};
+}