mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Add macro test
This commit is contained in:
parent
24ab69c608
commit
09a78caca4
1 changed files with 32 additions and 0 deletions
|
@ -3384,4 +3384,36 @@ fn foo() -> Result<(), i64> {
|
|||
}"##,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn param_usage_in_macro() {
|
||||
check_assist(
|
||||
extract_function,
|
||||
r"
|
||||
macro_rules! m {
|
||||
($val:expr) => { $val };
|
||||
}
|
||||
|
||||
fn foo() {
|
||||
let n = 1;
|
||||
$0let k = n * m!(n);$0
|
||||
let m = k + 1;
|
||||
}",
|
||||
r"
|
||||
macro_rules! m {
|
||||
($val:expr) => { $val };
|
||||
}
|
||||
|
||||
fn foo() {
|
||||
let n = 1;
|
||||
let k = fun_name(n);
|
||||
let m = k + 1;
|
||||
}
|
||||
|
||||
fn $0fun_name(n: i32) -> i32 {
|
||||
let k = n * m!(n);
|
||||
k
|
||||
}",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue