aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_editor/src/test_utils.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_editor/src/test_utils.rs')
-rw-r--r--crates/ra_editor/src/test_utils.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/crates/ra_editor/src/test_utils.rs b/crates/ra_editor/src/test_utils.rs
index 49eb530d5..bc3d700f6 100644
--- a/crates/ra_editor/src/test_utils.rs
+++ b/crates/ra_editor/src/test_utils.rs
@@ -1,12 +1,8 @@
1use ra_syntax::{File, TextUnit, TextRange};
2pub use crate::_test_utils::*;
3use crate::LocalEdit; 1use crate::LocalEdit;
2pub use crate::_test_utils::*;
3use ra_syntax::{File, TextRange, TextUnit};
4 4
5pub fn check_action<F: Fn(&File, TextUnit) -> Option<LocalEdit>> ( 5pub fn check_action<F: Fn(&File, TextUnit) -> Option<LocalEdit>>(before: &str, after: &str, f: F) {
6 before: &str,
7 after: &str,
8 f: F,
9) {
10 let (before_cursor_pos, before) = extract_offset(before); 6 let (before_cursor_pos, before) = extract_offset(before);
11 let file = File::parse(&before); 7 let file = File::parse(&before);
12 let result = f(&file, before_cursor_pos).expect("code action is not applicable"); 8 let result = f(&file, before_cursor_pos).expect("code action is not applicable");
@@ -19,7 +15,7 @@ pub fn check_action<F: Fn(&File, TextUnit) -> Option<LocalEdit>> (
19 assert_eq_text!(after, &actual); 15 assert_eq_text!(after, &actual);
20} 16}
21 17
22pub fn check_action_range<F: Fn(&File, TextRange) -> Option<LocalEdit>> ( 18pub fn check_action_range<F: Fn(&File, TextRange) -> Option<LocalEdit>>(
23 before: &str, 19 before: &str,
24 after: &str, 20 after: &str,
25 f: F, 21 f: F,