about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2023-12-27 17:29:52 -0800
committerDavid Tolnay <dtolnay@gmail.com>2024-05-11 15:49:00 -0700
commitc5a0eb12466b6591bc3a3d373c51fabd19735533 (patch)
treeb38d5ef2b0ef9c32558bccb660c32a6f150cc432
parent9e1cf2098d68356bccf7112bbff1d9b565e80a02 (diff)
downloadrust-c5a0eb12466b6591bc3a3d373c51fabd19735533.tar.gz
rust-c5a0eb12466b6591bc3a3d373c51fabd19735533.zip
Add ExprKind::MacCall statement boundary tests
-rw-r--r--tests/ui/macros/stringify.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/ui/macros/stringify.rs b/tests/ui/macros/stringify.rs
index 492bd2450b1..df1cf5d8a91 100644
--- a/tests/ui/macros/stringify.rs
+++ b/tests/ui/macros/stringify.rs
@@ -213,6 +213,21 @@ fn test_expr() {
         "match () { _ => ({ 1 }) - 1, }",
         "match () { _ => { 1 } - 1 }",
     );
+    c2_match_arm!(
+        [ m!() - 1 ],
+        "match () { _ => m!() - 1, }",
+        "match () { _ => m!() - 1 }",
+    );
+    c2_match_arm!(
+        [ m![] - 1 ],
+        "match () { _ => m![] - 1, }",
+        "match () { _ => m![] - 1 }",
+    );
+    c2_match_arm!(
+        [ m! {} - 1 ],
+        "match () { _ => m! {} - 1, }",
+        "match () { _ => m! {} - 1 }",
+    );
 
     // ExprKind::Closure
     c1!(expr, [ || {} ], "|| {}");
@@ -720,6 +735,21 @@ fn test_stmt() {
         "(loop { break 1; }) - 1;",
         "loop { break 1; } - 1",
     );
+    c2_minus_one!(
+        [ m!() ],
+        "m!() - 1;",
+        "m!() - 1"
+    );
+    c2_minus_one!(
+        [ m![] ],
+        "m![] - 1;",
+        "m![] - 1"
+    );
+    c2_minus_one!(
+        [ m! {} ],
+        "m! {} - 1;", // FIXME(dtolnay): needs parens, otherwise this is 2 separate statements
+        "m! {} - 1"
+    );
 
     // StmtKind::Empty
     c1!(stmt, [ ; ], ";");