diff --git a/crates/hir_def/src/macro_expansion_tests/mbe/matching.rs b/crates/hir_def/src/macro_expansion_tests/mbe/matching.rs index 5bdabfc598..9fb6d96b72 100644 --- a/crates/hir_def/src/macro_expansion_tests/mbe/matching.rs +++ b/crates/hir_def/src/macro_expansion_tests/mbe/matching.rs @@ -23,3 +23,30 @@ literal!(); "#]], ) } + +#[test] +fn test_expand_bad_literal() { + check( + r#" +macro_rules! m { ($i:literal) => {}; } +m!(&k"); +"#, + expect![[r#" +macro_rules! m { ($i:literal) => {}; } +/* error: Failed to lower macro args to token tree */"#]], + ); +} + +#[test] +fn test_empty_comments() { + check( + r#" +macro_rules! m{ ($fmt:expr) => (); } +m!(/**/); +"#, + expect![[r#" +macro_rules! m{ ($fmt:expr) => (); } +/* error: expected Expr */ +"#]], + ); +} diff --git a/crates/mbe/src/tests/expand.rs b/crates/mbe/src/tests/expand.rs index 8a23a0be53..3380e01fbc 100644 --- a/crates/mbe/src/tests/expand.rs +++ b/crates/mbe/src/tests/expand.rs @@ -96,26 +96,3 @@ fn test_attr_to_token_tree() { Some(tt::DelimiterKind::Bracket) ); } - -#[test] -fn test_expand_bad_literal() { - parse_macro( - r#" - macro_rules! foo { ($i:literal) => {}; } - "#, - ) - .assert_expand_err(r#"foo!(&k");"#, &ExpandError::BindingError("".into())); -} - -#[test] -fn test_empty_comments() { - parse_macro( - r#" - macro_rules! one_arg_macro { ($fmt:expr) => (); } - "#, - ) - .assert_expand_err( - r#"one_arg_macro!(/**/)"#, - &ExpandError::BindingError("expected Expr".into()), - ); -}