diff options
author | Aleksey Kladov <[email protected]> | 2020-06-24 10:05:47 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-06-24 10:05:47 +0100 |
commit | e9cb818c2683e06153f013c3b8d03f7f2719eb02 (patch) | |
tree | 1eab8c2aaa60acc56d69e88d2eb888c1395fdbc2 /crates/ra_ide/src/typing | |
parent | 08e2149eab4495bd816a30b3caf586bef2cd9649 (diff) |
Use fixtures more
Diffstat (limited to 'crates/ra_ide/src/typing')
-rw-r--r-- | crates/ra_ide/src/typing/on_enter.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/crates/ra_ide/src/typing/on_enter.rs b/crates/ra_ide/src/typing/on_enter.rs index a40d8af9c..787e85ffd 100644 --- a/crates/ra_ide/src/typing/on_enter.rs +++ b/crates/ra_ide/src/typing/on_enter.rs | |||
@@ -75,18 +75,15 @@ fn node_indent(file: &SourceFile, token: &SyntaxToken) -> Option<SmolStr> { | |||
75 | 75 | ||
76 | #[cfg(test)] | 76 | #[cfg(test)] |
77 | mod tests { | 77 | mod tests { |
78 | use test_utils::{assert_eq_text, extract_offset}; | 78 | use test_utils::assert_eq_text; |
79 | 79 | ||
80 | use crate::mock_analysis::single_file; | 80 | use crate::mock_analysis::single_file_with_position; |
81 | |||
82 | use super::*; | ||
83 | 81 | ||
84 | fn apply_on_enter(before: &str) -> Option<String> { | 82 | fn apply_on_enter(before: &str) -> Option<String> { |
85 | let (offset, before) = extract_offset(before); | 83 | let (analysis, position) = single_file_with_position(&before); |
86 | let (analysis, file_id) = single_file(&before); | 84 | let result = analysis.on_enter(position).unwrap()?; |
87 | let result = analysis.on_enter(FilePosition { offset, file_id }).unwrap()?; | ||
88 | 85 | ||
89 | let mut actual = before.to_string(); | 86 | let mut actual = analysis.file_text(position.file_id).unwrap().to_string(); |
90 | result.apply(&mut actual); | 87 | result.apply(&mut actual); |
91 | Some(actual) | 88 | Some(actual) |
92 | } | 89 | } |