diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_ide/src/mock_analysis.rs | 6 | ||||
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting/tests.rs | 11 |
2 files changed, 3 insertions, 14 deletions
diff --git a/crates/ra_ide/src/mock_analysis.rs b/crates/ra_ide/src/mock_analysis.rs index 5bad3911f..79b796544 100644 --- a/crates/ra_ide/src/mock_analysis.rs +++ b/crates/ra_ide/src/mock_analysis.rs | |||
@@ -126,12 +126,6 @@ impl MockAnalysis { | |||
126 | file_id | 126 | file_id |
127 | } | 127 | } |
128 | 128 | ||
129 | pub fn add_file(&mut self, path: &str, text: &str) -> FileId { | ||
130 | let file_id = self.next_id(); | ||
131 | self.files.push(MockFileData::new(path.to_string(), text.to_string())); | ||
132 | file_id | ||
133 | } | ||
134 | |||
135 | fn add_file_with_range(&mut self, path: &str, text: &str) -> FileRange { | 129 | fn add_file_with_range(&mut self, path: &str, text: &str) -> FileRange { |
136 | let (range, text) = extract_range(text); | 130 | let (range, text) = extract_range(text); |
137 | let file_id = self.next_id(); | 131 | let file_id = self.next_id(); |
diff --git a/crates/ra_ide/src/syntax_highlighting/tests.rs b/crates/ra_ide/src/syntax_highlighting/tests.rs index c8943816f..b7fad9719 100644 --- a/crates/ra_ide/src/syntax_highlighting/tests.rs +++ b/crates/ra_ide/src/syntax_highlighting/tests.rs | |||
@@ -2,10 +2,7 @@ use std::fs; | |||
2 | 2 | ||
3 | use test_utils::{assert_eq_text, project_dir, read_text}; | 3 | use test_utils::{assert_eq_text, project_dir, read_text}; |
4 | 4 | ||
5 | use crate::{ | 5 | use crate::{mock_analysis::single_file, FileRange, TextRange}; |
6 | mock_analysis::{single_file, MockAnalysis}, | ||
7 | FileRange, TextRange, | ||
8 | }; | ||
9 | 6 | ||
10 | #[test] | 7 | #[test] |
11 | fn test_highlighting() { | 8 | fn test_highlighting() { |
@@ -127,12 +124,10 @@ fn accidentally_quadratic() { | |||
127 | let file = project_dir().join("crates/ra_syntax/test_data/accidentally_quadratic"); | 124 | let file = project_dir().join("crates/ra_syntax/test_data/accidentally_quadratic"); |
128 | let src = fs::read_to_string(file).unwrap(); | 125 | let src = fs::read_to_string(file).unwrap(); |
129 | 126 | ||
130 | let mut mock = MockAnalysis::new(); | 127 | let (analysis, file_id) = single_file(&src); |
131 | let file_id = mock.add_file("/main.rs", &src); | ||
132 | let host = mock.analysis_host(); | ||
133 | 128 | ||
134 | // let t = std::time::Instant::now(); | 129 | // let t = std::time::Instant::now(); |
135 | let _ = host.analysis().highlight(file_id).unwrap(); | 130 | let _ = analysis.highlight(file_id).unwrap(); |
136 | // eprintln!("elapsed: {:?}", t.elapsed()); | 131 | // eprintln!("elapsed: {:?}", t.elapsed()); |
137 | } | 132 | } |
138 | 133 | ||