about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAleksey Kladov <aleksey.kladov@gmail.com>2021-10-10 11:26:18 +0300
committerAleksey Kladov <aleksey.kladov@gmail.com>2021-10-10 11:26:18 +0300
commit408475a59329c32766b4e4ad8296b6726e17bfec (patch)
treedc1de32f57a3042ac0dd8bcd376a8dd861e88551
parentb0a104cbd1482d0d108217075fae85e0349b54af (diff)
downloadrust-408475a59329c32766b4e4ad8296b6726e17bfec.tar.gz
rust-408475a59329c32766b4e4ad8296b6726e17bfec.zip
move test
-rw-r--r--crates/hir_def/src/macro_expansion_tests/mbe.rs58
-rw-r--r--crates/mbe/src/tests/expand.rs45
2 files changed, 58 insertions, 45 deletions
diff --git a/crates/hir_def/src/macro_expansion_tests/mbe.rs b/crates/hir_def/src/macro_expansion_tests/mbe.rs
index 9954544e91b..b4b4ad10ae0 100644
--- a/crates/hir_def/src/macro_expansion_tests/mbe.rs
+++ b/crates/hir_def/src/macro_expansion_tests/mbe.rs
@@ -878,3 +878,61 @@ mod c {}
 "#]],
     )
 }
+
+#[test]
+fn test_all_items() {
+    check(
+        r#"
+macro_rules! m { ($($i:item)*) => ($($i )*) }
+m! {
+    extern crate a;
+    mod b;
+    mod c {}
+    use d;
+    const E: i32 = 0;
+    static F: i32 = 0;
+    impl G {}
+    struct H;
+    enum I { Foo }
+    trait J {}
+    fn h() {}
+    extern {}
+    type T = u8;
+}
+"#,
+        expect![[r#"
+macro_rules! m { ($($i:item)*) => ($($i )*) }
+extern crate a;
+mod b;
+mod c {}
+use d;
+const E:i32 = 0;
+static F:i32 = 0;
+impl G {}
+struct H;
+enum I {
+    Foo
+}
+trait J {}
+fn h() {}
+extern {}
+type T = u8;
+"#]],
+    );
+}
+
+#[test]
+fn test_block() {
+    check(
+        r#"
+macro_rules! m { ($b:block) => { fn foo() $b } }
+m! { { 1; } }
+"#,
+        expect![[r#"
+macro_rules! m { ($b:block) => { fn foo() $b } }
+fn foo() {
+    1;
+}
+"#]],
+    );
+}
diff --git a/crates/mbe/src/tests/expand.rs b/crates/mbe/src/tests/expand.rs
index 2cb0fc4aad0..8fee2420760 100644
--- a/crates/mbe/src/tests/expand.rs
+++ b/crates/mbe/src/tests/expand.rs
@@ -102,51 +102,6 @@ fn test_attr_to_token_tree() {
 }
 
 #[test]
-fn test_all_items() {
-    parse_macro(
-        r#"
-        macro_rules! foo {
-            ($ ($ i:item)*) => ($ (
-                $ i
-            )*)
-        }
-"#,
-    ).
-    assert_expand_items(
-        r#"
-        foo! {
-            extern crate a;
-            mod b;
-            mod c {}
-            use d;
-            const E: i32 = 0;
-            static F: i32 = 0;
-            impl G {}
-            struct H;
-            enum I { Foo }
-            trait J {}
-            fn h() {}
-            extern {}
-            type T = u8;
-        }
-"#,
-        r#"extern crate a ; mod b ; mod c {} use d ; const E : i32 = 0 ; static F : i32 = 0 ; impl G {} struct H ; enum I {Foo} trait J {} fn h () {} extern {} type T = u8 ;"#,
-    );
-}
-
-#[test]
-fn test_block() {
-    parse_macro(
-        r#"
-        macro_rules! foo {
-            ($ i:block) => { fn foo() $ i }
-        }
-"#,
-    )
-    .assert_expand_statements("foo! { { 1; } }", "fn foo () {1 ;}");
-}
-
-#[test]
 fn test_meta() {
     parse_macro(
         r#"