From 357667104371d446cc029267e8095365c17ba085 Mon Sep 17 00:00:00 2001 From: Mikhail Rakhmanov Date: Fri, 12 Jun 2020 20:30:57 +0200 Subject: Rewrite snapshot checks --- crates/ra_ide/src/completion/patterns.rs | 84 ++++---------------------------- 1 file changed, 10 insertions(+), 74 deletions(-) (limited to 'crates/ra_ide/src/completion/patterns.rs') diff --git a/crates/ra_ide/src/completion/patterns.rs b/crates/ra_ide/src/completion/patterns.rs index 25be0c307..bc39689ab 100644 --- a/crates/ra_ide/src/completion/patterns.rs +++ b/crates/ra_ide/src/completion/patterns.rs @@ -121,115 +121,51 @@ mod tests { #[test] fn test_unsafe_is_prev() { - check_pattern_is_applicable( - r" - unsafe i<|> - ", - unsafe_is_prev, - ); + check_pattern_is_applicable(r"unsafe i<|>", unsafe_is_prev); } #[test] fn test_if_is_prev() { - check_pattern_is_applicable( - r" - if l<|> - ", - if_is_prev, - ); + check_pattern_is_applicable(r"if l<|>", if_is_prev); } #[test] fn test_inside_trait() { - check_pattern_is_applicable( - r" - trait A { - fn<|> - } - ", - inside_trait, - ); + check_pattern_is_applicable(r"trait A { fn<|> }", inside_trait); } #[test] fn test_has_trait_as_prev_sibling() { - check_pattern_is_applicable( - r" - trait A w<|> { - } - ", - has_trait_as_prev_sibling, - ); + check_pattern_is_applicable(r"trait A w<|> {}", has_trait_as_prev_sibling); } #[test] fn test_has_impl_as_prev_sibling() { - check_pattern_is_applicable( - r" - impl A w<|> { - } - ", - has_impl_as_prev_sibling, - ); + check_pattern_is_applicable(r"impl A w<|> {}", has_impl_as_prev_sibling); } #[test] fn test_parent_block_expr() { - check_pattern_is_applicable( - r" - fn my_fn() { - let a = 2; - f<|> - } - ", - has_block_expr_parent, - ); + check_pattern_is_applicable(r"fn my_fn() { let a = 2; f<|> }", has_block_expr_parent); } #[test] fn test_has_ref_pat_parent_in_func_parameters() { - check_pattern_is_applicable( - r" - fn my_fn(&<|>) { - let a = 2; - } - ", - has_ref_pat_parent, - ); + check_pattern_is_applicable(r"fn my_fn(&<|>) {}", has_ref_pat_parent); } #[test] fn test_has_ref_pat_parent_in_let_statement() { - check_pattern_is_applicable( - r" - fn my_fn() { - let &<|> - } - ", - has_ref_pat_parent, - ); + check_pattern_is_applicable(r"fn my_fn() { let &<|> }", has_ref_pat_parent); } #[test] fn test_has_bind_pat_parent_in_func_parameters() { - check_pattern_is_applicable( - r" - fn my_fn(m<|>) { - } - ", - has_bind_pat_parent, - ); + check_pattern_is_applicable(r"fn my_fn(m<|>) {}", has_bind_pat_parent); } #[test] fn test_has_bind_pat_parent_in_let_statement() { - check_pattern_is_applicable( - r" - fn my_fn() { - let m<|> - } - ", - has_bind_pat_parent, - ); + check_pattern_is_applicable(r"fn my_fn() { let m<|> }", has_bind_pat_parent); } } -- cgit v1.2.3