From 3888487ca8af25047351542dbf37b90e0029e230 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 20 Nov 2019 16:25:00 +0300 Subject: [PATCH] Remove duplicate tests --- crates/ra_ide_api/src/references/rename.rs | 132 --------------------- 1 file changed, 132 deletions(-) diff --git a/crates/ra_ide_api/src/references/rename.rs b/crates/ra_ide_api/src/references/rename.rs index 4ea372e6f0..d58496049e 100644 --- a/crates/ra_ide_api/src/references/rename.rs +++ b/crates/ra_ide_api/src/references/rename.rs @@ -121,140 +121,8 @@ mod tests { use crate::{ mock_analysis::analysis_and_position, mock_analysis::single_file_with_position, FileId, - ReferenceSearchResult, }; - #[test] - fn test_find_all_refs_for_local() { - let code = r#" - fn main() { - let mut i = 1; - let j = 1; - i = i<|> + j; - - { - i = 0; - } - - i = 5; - }"#; - - let refs = get_all_refs(code); - assert_eq!(refs.len(), 5); - } - - #[test] - fn test_find_all_refs_for_param_inside() { - let code = r#" - fn foo(i : u32) -> u32 { - i<|> - }"#; - - let refs = get_all_refs(code); - assert_eq!(refs.len(), 2); - } - - #[test] - fn test_find_all_refs_for_fn_param() { - let code = r#" - fn foo(i<|> : u32) -> u32 { - i - }"#; - - let refs = get_all_refs(code); - assert_eq!(refs.len(), 2); - } - - #[test] - fn test_find_all_refs_field_name() { - let code = r#" - //- /lib.rs - struct Foo { - pub spam<|>: u32, - } - - fn main(s: Foo) { - let f = s.spam; - } - "#; - - let refs = get_all_refs(code); - assert_eq!(refs.len(), 2); - } - - #[test] - fn test_find_all_refs_impl_item_name() { - let code = r#" - //- /lib.rs - struct Foo; - impl Foo { - fn f<|>(&self) { } - } - "#; - - let refs = get_all_refs(code); - assert_eq!(refs.len(), 1); - } - - #[test] - fn test_find_all_refs_enum_var_name() { - let code = r#" - //- /lib.rs - enum Foo { - A, - B<|>, - C, - } - "#; - - let refs = get_all_refs(code); - assert_eq!(refs.len(), 1); - } - - #[test] - fn test_find_all_refs_modules() { - let code = r#" - //- /lib.rs - pub mod foo; - pub mod bar; - - fn f() { - let i = foo::Foo { n: 5 }; - } - - //- /foo.rs - use crate::bar; - - pub struct Foo { - pub n: u32, - } - - fn f() { - let i = bar::Bar { n: 5 }; - } - - //- /bar.rs - use crate::foo; - - pub struct Bar { - pub n: u32, - } - - fn f() { - let i = foo::Foo<|> { n: 5 }; - } - "#; - - let (analysis, pos) = analysis_and_position(code); - let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); - assert_eq!(refs.len(), 3); - } - - fn get_all_refs(text: &str) -> ReferenceSearchResult { - let (analysis, position) = single_file_with_position(text); - analysis.find_all_refs(position, None).unwrap().unwrap() - } - #[test] fn test_rename_for_local() { test_rename(