aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_assists/src/handlers
diff options
context:
space:
mode:
authorBrandon <[email protected]>2021-04-11 19:12:02 +0100
committerBrandon <[email protected]>2021-04-11 19:12:02 +0100
commit09a78caca403f1b4be8711d00519094896928e58 (patch)
tree514ccf2d7b6d442006c8f02cfd1343224d041f6b /crates/ide_assists/src/handlers
parent24ab69c608e029d0146cd6b5b9e89f32a0483a34 (diff)
Add macro test
Diffstat (limited to 'crates/ide_assists/src/handlers')
-rw-r--r--crates/ide_assists/src/handlers/extract_function.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/crates/ide_assists/src/handlers/extract_function.rs b/crates/ide_assists/src/handlers/extract_function.rs
index 8e295098f..719f22053 100644
--- a/crates/ide_assists/src/handlers/extract_function.rs
+++ b/crates/ide_assists/src/handlers/extract_function.rs
@@ -3384,4 +3384,36 @@ fn foo() -> Result<(), i64> {
3384}"##, 3384}"##,
3385 ); 3385 );
3386 } 3386 }
3387
3388 #[test]
3389 fn param_usage_in_macro() {
3390 check_assist(
3391 extract_function,
3392 r"
3393macro_rules! m {
3394 ($val:expr) => { $val };
3395}
3396
3397fn foo() {
3398 let n = 1;
3399 $0let k = n * m!(n);$0
3400 let m = k + 1;
3401}",
3402 r"
3403macro_rules! m {
3404 ($val:expr) => { $val };
3405}
3406
3407fn foo() {
3408 let n = 1;
3409 let k = fun_name(n);
3410 let m = k + 1;
3411}
3412
3413fn $0fun_name(n: i32) -> i32 {
3414 let k = n * m!(n);
3415 k
3416}",
3417 );
3418 }
3387} 3419}