diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-31 07:00:11 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-31 07:00:11 +0000 |
commit | 777c79ce6bff0e70c8367f429f058f6d87ff3864 (patch) | |
tree | b1daaac6e059a679da654dbc2f7672ea605aedf0 /crates/ra_ide_api_light/src/test_utils.rs | |
parent | 28fdb8d03caf1ab8b40ed0fcbe8e47451fe030d9 (diff) | |
parent | a5fe4a08fb9b6e5df4f9aa1481fb62f6938897af (diff) |
Merge #712
712: Fix #667 and improvements to introduce_variable r=matklad a=eulerdisk
Fix #667 (but not re-indenting currently), plus many other improvements.
@matklad I'm not sure how to handle re-indenting here.
Co-authored-by: Andrea Pretto <[email protected]>
Diffstat (limited to 'crates/ra_ide_api_light/src/test_utils.rs')
-rw-r--r-- | crates/ra_ide_api_light/src/test_utils.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/ra_ide_api_light/src/test_utils.rs b/crates/ra_ide_api_light/src/test_utils.rs index dc2470aa3..22ded2435 100644 --- a/crates/ra_ide_api_light/src/test_utils.rs +++ b/crates/ra_ide_api_light/src/test_utils.rs | |||
@@ -23,6 +23,18 @@ pub fn check_action<F: Fn(&SourceFile, TextUnit) -> Option<LocalEdit>>( | |||
23 | assert_eq_text!(after, &actual); | 23 | assert_eq_text!(after, &actual); |
24 | } | 24 | } |
25 | 25 | ||
26 | pub fn check_action_not_applicable<F: Fn(&SourceFile, TextUnit) -> Option<LocalEdit>>( | ||
27 | text: &str, | ||
28 | f: F, | ||
29 | ) { | ||
30 | let (text_cursor_pos, text) = extract_offset(text); | ||
31 | let file = SourceFile::parse(&text); | ||
32 | assert!( | ||
33 | f(&file, text_cursor_pos).is_none(), | ||
34 | "code action is applicable but it shouldn't" | ||
35 | ); | ||
36 | } | ||
37 | |||
26 | pub fn check_action_range<F: Fn(&SourceFile, TextRange) -> Option<LocalEdit>>( | 38 | pub fn check_action_range<F: Fn(&SourceFile, TextRange) -> Option<LocalEdit>>( |
27 | before: &str, | 39 | before: &str, |
28 | after: &str, | 40 | after: &str, |