Skip to content

Commit de136a5

Browse files
committed
move test
1 parent e838da1 commit de136a5

File tree

2 files changed

+20
-22
lines changed

2 files changed

+20
-22
lines changed

crates/hir_def/src/macro_expansion_tests/mbe.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,3 +595,23 @@ fn bar() {}
595595
"#]],
596596
);
597597
}
598+
599+
#[test]
600+
fn test_parse_macro_def_rules() {
601+
cov_mark::check!(parse_macro_def_rules);
602+
603+
check(
604+
r#"
605+
macro m {
606+
($id:ident) => { fn $id() {} }
607+
}
608+
m!(bar);
609+
"#,
610+
expect![[r#"
611+
macro m {
612+
($id:ident) => { fn $id() {} }
613+
}
614+
fn bar() {}
615+
"#]],
616+
);
617+
}

crates/mbe/src/tests/expand.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,6 @@ fn to_subtree(tt: &tt::TokenTree) -> &tt::Subtree {
7777
}
7878
unreachable!("It is not a subtree");
7979
}
80-
fn to_literal(tt: &tt::TokenTree) -> &tt::Literal {
81-
if let tt::TokenTree::Leaf(tt::Leaf::Literal(lit)) = tt {
82-
return lit;
83-
}
84-
unreachable!("It is not a literal");
85-
}
8680

8781
fn to_punct(tt: &tt::TokenTree) -> &tt::Punct {
8882
if let tt::TokenTree::Leaf(tt::Leaf::Punct(lit)) = tt {
@@ -107,22 +101,6 @@ fn test_attr_to_token_tree() {
107101
);
108102
}
109103

110-
#[test]
111-
fn test_parse_macro_def_rules() {
112-
cov_mark::check!(parse_macro_def_rules);
113-
114-
parse_macro2(
115-
r#"
116-
macro foo {
117-
($id:ident) => {
118-
fn $id() {}
119-
}
120-
}
121-
"#,
122-
)
123-
.assert_expand_items("foo!(bar);", "fn bar () {}");
124-
}
125-
126104
#[test]
127105
fn test_macro_2_0_panic_2015() {
128106
parse_macro2(

0 commit comments

Comments
 (0)