]> git.lizzy.rs Git - rust.git/blobdiff - crates/hir_def/src/macro_expansion_tests/mbe/matching.rs
minor: add missing test
[rust.git] / crates / hir_def / src / macro_expansion_tests / mbe / matching.rs
index b93072d4466e420072a5cca8a0610a1981a458ac..bc162d0fa2069d465db9f6078eaeb3427bf62e39 100644 (file)
@@ -103,3 +103,36 @@ macro_rules! m {
 "#]],
     );
 }
+
+#[test]
+fn range_patterns() {
+    // FIXME: rustc thinks there are three patterns here, not one.
+    check(
+        r#"
+macro_rules! m {
+    ($($p:pat)*) => (stringify!($($p |)*);)
+}
+m!(.. .. ..);
+"#,
+        expect![[r#"
+macro_rules! m {
+    ($($p:pat)*) => (stringify!($($p |)*);)
+}
+stringify!(.. .. ..|);
+"#]],
+    );
+}
+
+#[test]
+fn trailing_vis() {
+    check(
+        r#"
+macro_rules! m { ($($i:ident)? $vis:vis) => () }
+m!(x pub);
+"#,
+        expect![[r#"
+macro_rules! m { ($($i:ident)? $vis:vis) => () }
+
+"#]],
+    )
+}