move test

This commit is contained in:
Aleksey Kladov 2021-10-10 15:06:41 +03:00
parent dce41e5a03
commit 0f849a7a35
2 changed files with 27 additions and 23 deletions

View file

@ -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 */
"#]],
);
}

View file

@ -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()),
);
}