move tests

This commit is contained in:
Aleksey Kladov 2021-10-09 17:43:07 +03:00
parent 6407e2e789
commit aac23f7832
2 changed files with 39 additions and 27 deletions

View file

@ -222,3 +222,42 @@ fn baz {
"#]],
)
}
#[test]
fn test_match_group_empty_fixed_token() {
check(
r#"
macro_rules! m {
($($i:ident)* #abc) => ( fn baz { $($i ();)* } );
}
m!{#abc}
"#,
expect![[r##"
macro_rules! m {
($($i:ident)* #abc) => ( fn baz { $($i ();)* } );
}
fn baz {}
"##]],
)
}
#[test]
fn test_match_group_in_subtree() {
check(
r#"
macro_rules! m {
(fn $name:ident { $($i:ident)* } ) => ( fn $name() { $($i ();)* } );
}
m! {fn baz { a b } }
"#,
expect![[r#"
macro_rules! m {
(fn $name:ident { $($i:ident)* } ) => ( fn $name() { $($i ();)* } );
}
fn baz() {
a();
b();
}
"#]],
)
}

View file

@ -209,33 +209,6 @@ fn test_expr_order() {
);
}
#[test]
fn test_match_group_empty_fixed_token() {
parse_macro(
r#"
macro_rules! foo {
($ ($ i:ident)* #abc) => ( fn baz { $ (
$ i ();
)*} );
}
"#,
)
.assert_expand_items("foo! {#abc}", "fn baz {}");
}
#[test]
fn test_match_group_in_subtree() {
parse_macro(
r#"
macro_rules! foo {
(fn $name:ident {$($i:ident)*} ) => ( fn $name() { $ (
$ i ();
)*} );
}"#,
)
.assert_expand_items("foo! {fn baz {a b} }", "fn baz () {a () ; b () ;}");
}
#[test]
fn test_match_group_with_multichar_sep() {
parse_macro(