internal: move tests

This commit is contained in:
Aleksey Kladov 2021-10-09 18:54:15 +03:00
parent 0dc87badd7
commit e838da18a9
2 changed files with 33 additions and 28 deletions

View File

@ -562,3 +562,36 @@ fn f() -> i32 {
"#]],
);
}
#[test]
fn test_match_literal() {
check(
r#"
macro_rules! m {
('(') => { fn l_paren() {} }
}
m!['('];
"#,
expect![[r#"
macro_rules! m {
('(') => { fn l_paren() {} }
}
fn l_paren() {}
"#]],
);
}
#[test]
fn test_parse_macro_def_simple() {
cov_mark::check!(parse_macro_def_simple);
check(
r#"
macro m($id:ident) { fn $id() {} }
m!(bar);
"#,
expect![[r#"
macro m($id:ident) { fn $id() {} }
fn bar() {}
"#]],
);
}

View File

@ -107,34 +107,6 @@ fn test_attr_to_token_tree() {
);
}
#[test]
fn test_match_literal() {
parse_macro(
r#"
macro_rules! foo {
('(') => {
fn foo() {}
}
}
"#,
)
.assert_expand_items("foo! ['('];", "fn foo () {}");
}
#[test]
fn test_parse_macro_def_simple() {
cov_mark::check!(parse_macro_def_simple);
parse_macro2(
r#"
macro foo($id:ident) {
fn $id() {}
}
"#,
)
.assert_expand_items("foo!(bar);", "fn bar () {}");
}
#[test]
fn test_parse_macro_def_rules() {
cov_mark::check!(parse_macro_def_rules);