aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/test_utils.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-05-21 15:14:53 +0100
committerGitHub <[email protected]>2020-05-21 15:14:53 +0100
commitba6cf638fbf3d0a025e804f2d354d91abc8afd28 (patch)
treea1d66d2b8e06d2e32f9a4d0ce9857948dd981459 /crates/ra_ide/src/test_utils.rs
parent3cba0dc26b707bebc1865671fd2c5139c1e1c537 (diff)
parentef0da3bbeccdaab3813a1f6a17c566ca9087615f (diff)
Merge #4553
4553: Cleanup r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/test_utils.rs')
-rw-r--r--crates/ra_ide/src/test_utils.rs25
1 files changed, 0 insertions, 25 deletions
diff --git a/crates/ra_ide/src/test_utils.rs b/crates/ra_ide/src/test_utils.rs
deleted file mode 100644
index 48c8fd1f4..000000000
--- a/crates/ra_ide/src/test_utils.rs
+++ /dev/null
@@ -1,25 +0,0 @@
1//! FIXME: write short doc here
2
3use ra_syntax::{SourceFile, TextSize};
4use ra_text_edit::TextEdit;
5
6pub use test_utils::*;
7
8pub fn check_action<F: Fn(&SourceFile, TextSize) -> Option<TextEdit>>(
9 before: &str,
10 after: &str,
11 f: F,
12) {
13 let (before_cursor_pos, before) = extract_offset(before);
14 let file = SourceFile::parse(&before).ok().unwrap();
15 let result = f(&file, before_cursor_pos).expect("code action is not applicable");
16 let actual = {
17 let mut actual = before.to_string();
18 result.apply(&mut actual);
19 actual
20 };
21 let actual_cursor_pos =
22 result.apply_to_offset(before_cursor_pos).expect("cursor position is affected by the edit");
23 let actual = add_cursor(&actual, actual_cursor_pos);
24 assert_eq_text!(after, &actual);
25}