From b1cfa51ef5d1de85c555e3fb2722a64612cf40ca Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 9 Oct 2021 18:43:15 +0300 Subject: [PATCH] internal: move tests --- .../hir_def/src/macro_expansion_tests/mbe.rs | 32 +++++++++++++++++++ crates/mbe/src/tests/expand.rs | 22 ------------- 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/crates/hir_def/src/macro_expansion_tests/mbe.rs b/crates/hir_def/src/macro_expansion_tests/mbe.rs index 384c70028df..993c7d99b7b 100644 --- a/crates/hir_def/src/macro_expansion_tests/mbe.rs +++ b/crates/hir_def/src/macro_expansion_tests/mbe.rs @@ -383,3 +383,35 @@ fn baz() -> bool { "#]], ); } + +#[test] +fn test_match_group_zero_match() { + check( + r#" +macro_rules! m { ( $($i:ident)* ) => (); } +m!(); +"#, + expect![[r#" +macro_rules! m { ( $($i:ident)* ) => (); } + +"#]], + ); +} + +#[test] +fn test_match_group_in_group() { + check( + r#" +macro_rules! m { + [ $( ( $($i:ident)* ) )* ] => [ x![$( ( $($i)* ) )*]; ] +} +m! ( (a b) ); +"#, + expect![[r#" +macro_rules! m { + [ $( ( $($i:ident)* ) )* ] => [ x![$( ( $($i)* ) )*]; ] +} +x![(a b)]; +"#]], + ) +} diff --git a/crates/mbe/src/tests/expand.rs b/crates/mbe/src/tests/expand.rs index c08788cda1e..b3b6fce58dd 100644 --- a/crates/mbe/src/tests/expand.rs +++ b/crates/mbe/src/tests/expand.rs @@ -71,28 +71,6 @@ macro_rules! foobar { assert_eq!(get_text(tt::TokenId(13), T!['{']), "{"); } -#[test] -fn test_match_group_zero_match() { - parse_macro( - r#" - macro_rules! foo { - ( $($i:ident)* ) => (); - }"#, - ) - .assert_expand_items("foo! ();", ""); -} - -#[test] -fn test_match_group_in_group() { - parse_macro( - r#" - macro_rules! foo { - { $( ( $($i:ident)* ) )* } => ( $( ( $($i)* ) )* ); - }"#, - ) - .assert_expand_items("foo! ( (a b) );", "(a b)"); -} - #[test] fn test_expand_to_item_list() { let tree = parse_macro(