From 6d5443ef945c415f21ced1594003e8e6eed5e44a Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sun, 22 Mar 2020 19:53:34 +0800 Subject: Add test --- crates/ra_ide/src/references/rename.rs | 57 ++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs index 7d1190af9..9acc6158a 100644 --- a/crates/ra_ide/src/references/rename.rs +++ b/crates/ra_ide/src/references/rename.rs @@ -249,6 +249,63 @@ mod tests { ); } + #[test] + fn test_rename_for_macro_args_rev() { + test_rename( + r#" + macro_rules! foo {($i:ident) => {$i} } + fn main() { + let a = "test"; + foo!(a<|>); + }"#, + "b", + r#" + macro_rules! foo {($i:ident) => {$i} } + fn main() { + let b = "test"; + foo!(b); + }"#, + ); + } + + #[test] + fn test_rename_for_macro_define_fn() { + test_rename( + r#" + macro_rules! define_fn {($id:ident) => { fn $id{} }} + define_fn!(foo); + fn main() { + fo<|>o(); + }"#, + "bar", + r#" + macro_rules! define_fn {($id:ident) => { fn $id{} }} + define_fn!(bar); + fn main() { + bar(); + }"#, + ); + } + + #[test] + fn test_rename_for_macro_define_fn_rev() { + test_rename( + r#" + macro_rules! define_fn {($id:ident) => { fn $id{} }} + define_fn!(fo<|>o); + fn main() { + foo(); + }"#, + "bar", + r#" + macro_rules! define_fn {($id:ident) => { fn $id{} }} + define_fn!(bar); + fn main() { + bar(); + }"#, + ); + } + #[test] fn test_rename_for_param_inside() { test_rename( -- cgit v1.2.3