Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir_def/src/macro_expansion_tests.rs')
| -rw-r--r-- | crates/hir_def/src/macro_expansion_tests.rs | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/crates/hir_def/src/macro_expansion_tests.rs b/crates/hir_def/src/macro_expansion_tests.rs index 861a059a14..8ecdbec7ae 100644 --- a/crates/hir_def/src/macro_expansion_tests.rs +++ b/crates/hir_def/src/macro_expansion_tests.rs @@ -69,7 +69,7 @@ fn check(ra_fixture: &str, expect: Expect) { } #[test] -fn test_expand_rule() { +fn wrong_nesting_level() { check( r#" macro_rules! m { @@ -85,3 +85,23 @@ macro_rules! m { "#]], ); } + +#[test] +fn expansion_does_not_parse_as_expression() { + check( + r#" +macro_rules! stmts { + () => { let _ = 0; } +} + +fn f() { let _ = stmts!(); } +"#, + expect![[r#" +macro_rules! stmts { + () => { let _ = 0; } +} + +fn f() { let _ = /* error: could not convert tokens */; } +"#]], + ) +} |