mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-25 01:17:45 +00:00
internal: Thread edition through to parsing/tt-to-syntax-tree routines for macros
This commit is contained in:
parent
83370fe5d7
commit
a483d3bc37
39 changed files with 187 additions and 145 deletions
|
|
@ -89,6 +89,7 @@ fn if_block_condition() {
|
|||
else { "else" }
|
||||
}
|
||||
"#,
|
||||
parser::Edition::CURRENT,
|
||||
);
|
||||
let if_ = parse.tree().syntax().descendants().find_map(ast::IfExpr::cast).unwrap();
|
||||
assert_eq!(if_.then_branch().unwrap().syntax().text(), r#"{ "if" }"#);
|
||||
|
|
@ -123,6 +124,7 @@ fn if_condition_with_if_inside() {
|
|||
else { "else" }
|
||||
}
|
||||
"#,
|
||||
parser::Edition::CURRENT,
|
||||
);
|
||||
let if_ = parse.tree().syntax().descendants().find_map(ast::IfExpr::cast).unwrap();
|
||||
assert_eq!(if_.then_branch().unwrap().syntax().text(), r#"{ "if" }"#);
|
||||
|
|
@ -386,7 +388,8 @@ impl ast::BlockExpr {
|
|||
|
||||
#[test]
|
||||
fn test_literal_with_attr() {
|
||||
let parse = ast::SourceFile::parse(r#"const _: &str = { #[attr] "Hello" };"#);
|
||||
let parse =
|
||||
ast::SourceFile::parse(r#"const _: &str = { #[attr] "Hello" };"#, parser::Edition::CURRENT);
|
||||
let lit = parse.tree().syntax().descendants().find_map(ast::Literal::cast).unwrap();
|
||||
assert_eq!(lit.token().text(), r#""Hello""#);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue