Skip to content

Commit e53792b

Browse files
committed
Auto merge of rust-lang#16256 - Urhengulas:ide-runnables-assert_eq, r=Veykril
internal: Only compare relevant parts in `ide::{runnables,inlay_hints}` tests This PR limits the data being compared. Therefore the tests should be more readable, as well as being more robust to changes to the data structure. Part of rust-lang/rust-analyzer#14268.
2 parents 2271b82 + f8ff4fb commit e53792b

File tree

3 files changed

+226
-1584
lines changed

3 files changed

+226
-1584
lines changed

crates/ide/src/inlay_hints.rs

-24
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,6 @@ mod tests {
593593
use hir::ClosureStyle;
594594
use itertools::Itertools;
595595
use test_utils::extract_annotations;
596-
use text_edit::{TextRange, TextSize};
597596

598597
use crate::inlay_hints::{AdjustmentHints, AdjustmentHintsMode};
599598
use crate::DiscriminantHints;
@@ -654,29 +653,6 @@ mod tests {
654653
assert_eq!(expected, actual, "\nExpected:\n{expected:#?}\n\nActual:\n{actual:#?}");
655654
}
656655

657-
#[track_caller]
658-
pub(super) fn check_expect(config: InlayHintsConfig, ra_fixture: &str, expect: Expect) {
659-
let (analysis, file_id) = fixture::file(ra_fixture);
660-
let inlay_hints = analysis.inlay_hints(&config, file_id, None).unwrap();
661-
expect.assert_debug_eq(&inlay_hints)
662-
}
663-
664-
#[track_caller]
665-
pub(super) fn check_expect_clear_loc(
666-
config: InlayHintsConfig,
667-
ra_fixture: &str,
668-
expect: Expect,
669-
) {
670-
let (analysis, file_id) = fixture::file(ra_fixture);
671-
let mut inlay_hints = analysis.inlay_hints(&config, file_id, None).unwrap();
672-
inlay_hints.iter_mut().flat_map(|hint| &mut hint.label.parts).for_each(|hint| {
673-
if let Some(loc) = &mut hint.linked_location {
674-
loc.range = TextRange::empty(TextSize::from(0));
675-
}
676-
});
677-
expect.assert_debug_eq(&inlay_hints)
678-
}
679-
680656
/// Computes inlay hints for the fixture, applies all the provided text edits and then runs
681657
/// expect test.
682658
#[track_caller]

0 commit comments

Comments
 (0)