aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-05-31 12:13:48 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-05-31 12:13:48 +0100
commit6c1ec865fb931ffd789e2caa9e2ce82d1df97c4d (patch)
treeb33fea67d1076aef89a4e88bd53d871024b3c233
parent29c7cdb25edb0ad5480c108a64a117cf9c318c34 (diff)
parentbe15541b031c036ce1b5f0d7f31c32dd398ba5c7 (diff)
Merge #1354
1354: Sort hover results in tests r=matklad a=lnicola Co-authored-by: LaurenČ›iu Nicola <[email protected]>
-rw-r--r--crates/ra_ide_api/src/hover.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs
index a390dab65..9c35db2a4 100644
--- a/crates/ra_ide_api/src/hover.rs
+++ b/crates/ra_ide_api/src/hover.rs
@@ -5,7 +5,11 @@ use ra_syntax::{
5}; 5};
6use hir::HirDisplay; 6use hir::HirDisplay;
7 7
8use crate::{db::RootDatabase, RangeInfo, FilePosition, FileRange, display::{rust_code_markup, doc_text_for}}; 8use crate::{
9 db::RootDatabase,
10 RangeInfo, FilePosition, FileRange,
11 display::{rust_code_markup, doc_text_for},
12};
9 13
10/// Contains the results when hovering over an item 14/// Contains the results when hovering over an item
11#[derive(Debug, Clone)] 15#[derive(Debug, Clone)]
@@ -155,9 +159,11 @@ mod tests {
155 fn check_hover_result(fixture: &str, expected: &[&str]) { 159 fn check_hover_result(fixture: &str, expected: &[&str]) {
156 let (analysis, position) = analysis_and_position(fixture); 160 let (analysis, position) = analysis_and_position(fixture);
157 let hover = analysis.hover(position).unwrap().unwrap(); 161 let hover = analysis.hover(position).unwrap().unwrap();
162 let mut results = Vec::from(hover.info.results());
163 results.sort();
158 164
159 for (markup, expected) in 165 for (markup, expected) in
160 hover.info.results().iter().zip(expected.iter().chain(std::iter::repeat(&"<missing>"))) 166 results.iter().zip(expected.iter().chain(std::iter::repeat(&"<missing>")))
161 { 167 {
162 assert_eq!(trim_markup(&markup), *expected); 168 assert_eq!(trim_markup(&markup), *expected);
163 } 169 }