Unnamed repository; edit this file 'description' to name the repository.
internal: move tests
| -rw-r--r-- | crates/hir_def/src/macro_expansion_tests/mbe.rs | 42 | ||||
| -rw-r--r-- | crates/mbe/src/tests/expand.rs | 37 |
2 files changed, 42 insertions, 37 deletions
diff --git a/crates/hir_def/src/macro_expansion_tests/mbe.rs b/crates/hir_def/src/macro_expansion_tests/mbe.rs index 958f2a1c33..0d3d86c8ad 100644 --- a/crates/hir_def/src/macro_expansion_tests/mbe.rs +++ b/crates/hir_def/src/macro_expansion_tests/mbe.rs @@ -778,3 +778,45 @@ x!(); "#]], ) } + +#[test] +fn test_ty() { + check( + r#" +macro_rules! foo { + ($t:ty) => ( fn bar() -> $t {} ) +} +foo! { Baz<u8> } +"#, + expect![[r#" +macro_rules! foo { + ($t:ty) => ( fn bar() -> $t {} ) +} +fn bar() -> Baz<u8> {} +"#]], + ) +} + +#[test] +fn test_ty_with_complex_type() { + check( + r#" +macro_rules! foo { + ($t:ty) => ( fn bar() -> $ t {} ) +} + +foo! { &'a Baz<u8> } + +foo! { extern "Rust" fn() -> Ret } +"#, + expect![[r#" +macro_rules! foo { + ($t:ty) => ( fn bar() -> $ t {} ) +} + +fn bar() -> & 'a Baz<u8> {} + +fn bar() -> extern"Rust"fn() -> Ret {} +"#]], + ); +} diff --git a/crates/mbe/src/tests/expand.rs b/crates/mbe/src/tests/expand.rs index 01b5533522..8528318152 100644 --- a/crates/mbe/src/tests/expand.rs +++ b/crates/mbe/src/tests/expand.rs @@ -102,43 +102,6 @@ fn test_attr_to_token_tree() { } #[test] -fn test_ty() { - parse_macro( - r#" - macro_rules! foo { - ($ i:ty) => ( - fn bar() -> $ i { unimplemented!() } - ) - } -"#, - ) - .assert_expand_items("foo! { Baz<u8> }", "fn bar () -> Baz < u8 > {unimplemented ! ()}"); -} - -#[test] -fn test_ty_with_complex_type() { - parse_macro( - r#" - macro_rules! foo { - ($ i:ty) => ( - fn bar() -> $ i { unimplemented!() } - ) - } -"#, - ) - // Reference lifetime struct with generic type - .assert_expand_items( - "foo! { &'a Baz<u8> }", - "fn bar () -> & 'a Baz < u8 > {unimplemented ! ()}", - ) - // extern "Rust" func type - .assert_expand_items( - r#"foo! { extern "Rust" fn() -> Ret }"#, - r#"fn bar () -> extern "Rust" fn () -> Ret {unimplemented ! ()}"#, - ); -} - -#[test] fn test_pat_() { parse_macro( r#" |