internal: move test
This commit is contained in:
parent
093f99b809
commit
78ca43ef3d
@ -69,7 +69,7 @@ fn check(ra_fixture: &str, expect: Expect) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_expand_rule() {
|
fn wrong_nesting_level() {
|
||||||
check(
|
check(
|
||||||
r#"
|
r#"
|
||||||
macro_rules! m {
|
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 */; }
|
||||||
|
"#]],
|
||||||
|
)
|
||||||
|
}
|
||||||
|
@ -797,24 +797,6 @@ macro_rules! literals {
|
|||||||
assert_eq!(tokens[2 + 15 + 3].0, STRING);
|
assert_eq!(tokens[2 + 15 + 3].0, STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn stmts_token_trees_to_expr_is_err() {
|
|
||||||
let expansion = parse_macro(
|
|
||||||
r#"
|
|
||||||
macro_rules! stmts {
|
|
||||||
() => {
|
|
||||||
let a = 0;
|
|
||||||
let b = 0;
|
|
||||||
let c = 0;
|
|
||||||
let d = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.expand_tt("stmts!();");
|
|
||||||
assert!(token_tree_to_syntax_node(&expansion, ParserEntryPoint::Expr).is_err());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_token_tree_last_child_is_white_space() {
|
fn test_token_tree_last_child_is_white_space() {
|
||||||
let source_file = ast::SourceFile::parse("f!{}").ok().unwrap();
|
let source_file = ast::SourceFile::parse("f!{}").ok().unwrap();
|
||||||
|
Loading…
Reference in New Issue
Block a user