internal: move tests

This commit is contained in:
Aleksey Kladov 2021-10-09 14:22:49 +03:00
parent 49f5fecf06
commit 1abe3f8275
2 changed files with 20 additions and 8 deletions

View File

@ -151,3 +151,23 @@ macro_rules! m {
"#]], "#]],
) )
} }
#[test]
fn broken_parenthesis_sequence() {
check(
r#"
macro_rules! m1 { ($x:ident) => { ($x } }
macro_rules! m2 { ($x:ident) => {} }
m1!();
m2!(x
"#,
expect![[r#"
macro_rules! m1 { ($x:ident) => { ($x } }
macro_rules! m2 { ($x:ident) => {} }
/* error: Failed to find macro definition */
/* error: Failed to lower macro args to token tree */
"#]],
)
}

View File

@ -821,12 +821,4 @@ fn test_token_tree_last_child_is_white_space() {
let tt = syntax_node_to_token_tree(token_tree.syntax()).0; let tt = syntax_node_to_token_tree(token_tree.syntax()).0;
assert_eq!(tt.delimiter_kind(), Some(tt::DelimiterKind::Brace)); assert_eq!(tt.delimiter_kind(), Some(tt::DelimiterKind::Brace));
} }
#[test]
fn test_missing_closing_delim() {
let source_file = ast::SourceFile::parse("m!(x").tree();
let node = source_file.syntax().descendants().find_map(ast::TokenTree::cast).unwrap();
let tt = syntax_node_to_token_tree(node.syntax()).0.to_string();
assert_eq_text!(&*tt, "( x");
}
} }