mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Sort hover results in tests
This commit is contained in:
parent
29c7cdb25e
commit
be15541b03
1 changed files with 8 additions and 2 deletions
|
@ -5,7 +5,11 @@ use ra_syntax::{
|
||||||
};
|
};
|
||||||
use hir::HirDisplay;
|
use hir::HirDisplay;
|
||||||
|
|
||||||
use crate::{db::RootDatabase, RangeInfo, FilePosition, FileRange, display::{rust_code_markup, doc_text_for}};
|
use crate::{
|
||||||
|
db::RootDatabase,
|
||||||
|
RangeInfo, FilePosition, FileRange,
|
||||||
|
display::{rust_code_markup, doc_text_for},
|
||||||
|
};
|
||||||
|
|
||||||
/// Contains the results when hovering over an item
|
/// Contains the results when hovering over an item
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
@ -155,9 +159,11 @@ mod tests {
|
||||||
fn check_hover_result(fixture: &str, expected: &[&str]) {
|
fn check_hover_result(fixture: &str, expected: &[&str]) {
|
||||||
let (analysis, position) = analysis_and_position(fixture);
|
let (analysis, position) = analysis_and_position(fixture);
|
||||||
let hover = analysis.hover(position).unwrap().unwrap();
|
let hover = analysis.hover(position).unwrap().unwrap();
|
||||||
|
let mut results = Vec::from(hover.info.results());
|
||||||
|
results.sort();
|
||||||
|
|
||||||
for (markup, expected) in
|
for (markup, expected) in
|
||||||
hover.info.results().iter().zip(expected.iter().chain(std::iter::repeat(&"<missing>")))
|
results.iter().zip(expected.iter().chain(std::iter::repeat(&"<missing>")))
|
||||||
{
|
{
|
||||||
assert_eq!(trim_markup(&markup), *expected);
|
assert_eq!(trim_markup(&markup), *expected);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue