aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/mock_analysis.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_ide/src/mock_analysis.rs b/crates/ra_ide/src/mock_analysis.rs
index d480fcf62..f15990158 100644
--- a/crates/ra_ide/src/mock_analysis.rs
+++ b/crates/ra_ide/src/mock_analysis.rs
@@ -3,7 +3,7 @@ use std::{str::FromStr, sync::Arc};
3 3
4use ra_cfg::CfgOptions; 4use ra_cfg::CfgOptions;
5use ra_db::{CrateName, Env, FileSet, SourceRoot, VfsPath}; 5use ra_db::{CrateName, Env, FileSet, SourceRoot, VfsPath};
6use test_utils::{extract_offset, extract_range, parse_fixture, FixtureEntry, CURSOR_MARKER}; 6use test_utils::{extract_offset, extract_range, Fixture, CURSOR_MARKER};
7 7
8use crate::{ 8use crate::{
9 Analysis, AnalysisChange, AnalysisHost, CrateGraph, Edition, FileId, FilePosition, FileRange, 9 Analysis, AnalysisChange, AnalysisHost, CrateGraph, Edition, FileId, FilePosition, FileRange,
@@ -12,7 +12,7 @@ use crate::{
12#[derive(Debug)] 12#[derive(Debug)]
13enum MockFileData { 13enum MockFileData {
14 Plain { path: String, content: String }, 14 Plain { path: String, content: String },
15 Fixture(FixtureEntry), 15 Fixture(Fixture),
16} 16}
17 17
18impl MockFileData { 18impl MockFileData {
@@ -60,8 +60,8 @@ impl MockFileData {
60 } 60 }
61} 61}
62 62
63impl From<FixtureEntry> for MockFileData { 63impl From<Fixture> for MockFileData {
64 fn from(fixture: FixtureEntry) -> Self { 64 fn from(fixture: Fixture) -> Self {
65 Self::Fixture(fixture) 65 Self::Fixture(fixture)
66 } 66 }
67} 67}
@@ -89,7 +89,7 @@ impl MockAnalysis {
89 /// ``` 89 /// ```
90 pub fn with_files(fixture: &str) -> MockAnalysis { 90 pub fn with_files(fixture: &str) -> MockAnalysis {
91 let mut res = MockAnalysis::new(); 91 let mut res = MockAnalysis::new();
92 for entry in parse_fixture(fixture) { 92 for entry in Fixture::parse(fixture) {
93 res.add_file_fixture(entry); 93 res.add_file_fixture(entry);
94 } 94 }
95 res 95 res
@@ -100,7 +100,7 @@ impl MockAnalysis {
100 pub fn with_files_and_position(fixture: &str) -> (MockAnalysis, FilePosition) { 100 pub fn with_files_and_position(fixture: &str) -> (MockAnalysis, FilePosition) {
101 let mut position = None; 101 let mut position = None;
102 let mut res = MockAnalysis::new(); 102 let mut res = MockAnalysis::new();
103 for entry in parse_fixture(fixture) { 103 for entry in Fixture::parse(fixture) {
104 if entry.text.contains(CURSOR_MARKER) { 104 if entry.text.contains(CURSOR_MARKER) {
105 assert!(position.is_none(), "only one marker (<|>) per fixture is allowed"); 105 assert!(position.is_none(), "only one marker (<|>) per fixture is allowed");
106 position = Some(res.add_file_fixture_with_position(entry)); 106 position = Some(res.add_file_fixture_with_position(entry));
@@ -112,13 +112,13 @@ impl MockAnalysis {
112 (res, position) 112 (res, position)
113 } 113 }
114 114
115 pub fn add_file_fixture(&mut self, fixture: FixtureEntry) -> FileId { 115 pub fn add_file_fixture(&mut self, fixture: Fixture) -> FileId {
116 let file_id = self.next_id(); 116 let file_id = self.next_id();
117 self.files.push(MockFileData::from(fixture)); 117 self.files.push(MockFileData::from(fixture));
118 file_id 118 file_id
119 } 119 }
120 120
121 pub fn add_file_fixture_with_position(&mut self, mut fixture: FixtureEntry) -> FilePosition { 121 pub fn add_file_fixture_with_position(&mut self, mut fixture: Fixture) -> FilePosition {
122 let (offset, text) = extract_offset(&fixture.text); 122 let (offset, text) = extract_offset(&fixture.text);
123 fixture.text = text; 123 fixture.text = text;
124 let file_id = self.next_id(); 124 let file_id = self.next_id();