Unnamed repository; edit this file 'description' to name the repository.
internal: move test
| -rw-r--r-- | crates/hir_def/src/macro_expansion_tests/mbe.rs | 66 | ||||
| -rw-r--r-- | crates/mbe/src/tests/expand.rs | 50 |
2 files changed, 66 insertions, 50 deletions
diff --git a/crates/hir_def/src/macro_expansion_tests/mbe.rs b/crates/hir_def/src/macro_expansion_tests/mbe.rs index a06e433ed2..213474c169 100644 --- a/crates/hir_def/src/macro_expansion_tests/mbe.rs +++ b/crates/hir_def/src/macro_expansion_tests/mbe.rs @@ -496,3 +496,69 @@ fn foo() { "#]], ); } + +#[test] +fn test_tt_to_stmts() { + check( + r#" +macro_rules! m { + () => { + let a = 0; + a = 10 + 1; + a + } +} + +fn f() -> i32 { + // +tree + m!{} +} +"#, + expect![[r#" +macro_rules! m { + () => { + let a = 0; + a = 10 + 1; + a + } +} + +fn f() -> i32 { + let a = 0; + a = 10+1; + a +// [email protected] "let" +// [email protected] "a" +// [email protected] "=" +// [email protected] "0" +// [email protected] ";" +// [email protected] "a" +// [email protected] "=" +// [email protected] "10" +// [email protected] "+" +// [email protected] "1" +// [email protected] ";" +// [email protected] "a" + +} +"#]], + ); +} diff --git a/crates/mbe/src/tests/expand.rs b/crates/mbe/src/tests/expand.rs index 4c7d14aaf2..6991c4b001 100644 --- a/crates/mbe/src/tests/expand.rs +++ b/crates/mbe/src/tests/expand.rs @@ -108,56 +108,6 @@ fn test_attr_to_token_tree() { } #[test] -fn test_tt_to_stmts() { - let stmts = parse_macro( - r#" - macro_rules! foo { - () => { - let a = 0; - a = 10 + 1; - a - } - } -"#, - ) - .expand_statements("foo!{}"); - - assert_eq!( - format!("{:#?}", stmts).trim(), - r#"[email protected] - [email protected] "let" - [email protected] "a" - [email protected] "=" - [email protected] "0" - [email protected] ";" - [email protected] "a" - [email protected] "=" - [email protected] "10" - [email protected] "+" - [email protected] "1" - [email protected] ";" - [email protected] "a""#, - ); -} - -#[test] fn test_match_literal() { parse_macro( r#" |