@@ -75,12 +75,12 @@ pub(super) fn hints(
7575
7676#[ cfg( test) ]
7777mod tests {
78- use expect_test:: expect;
78+ use expect_test:: { expect, Expect } ;
79+ use text_edit:: { TextRange , TextSize } ;
7980
8081 use crate :: {
81- inlay_hints:: tests:: {
82- check_expect, check_expect_clear_loc, check_with_config, DISABLED_CONFIG , TEST_CONFIG ,
83- } ,
82+ fixture,
83+ inlay_hints:: tests:: { check_with_config, DISABLED_CONFIG , TEST_CONFIG } ,
8484 InlayHintsConfig ,
8585 } ;
8686
@@ -89,6 +89,33 @@ mod tests {
8989 check_with_config ( InlayHintsConfig { chaining_hints : true , ..DISABLED_CONFIG } , ra_fixture) ;
9090 }
9191
92+ #[ track_caller]
93+ pub ( super ) fn check_expect ( config : InlayHintsConfig , ra_fixture : & str , expect : Expect ) {
94+ let ( analysis, file_id) = fixture:: file ( ra_fixture) ;
95+ let inlay_hints = analysis. inlay_hints ( & config, file_id, None ) . unwrap ( ) ;
96+ let filtered =
97+ inlay_hints. into_iter ( ) . map ( |hint| ( hint. range , hint. label ) ) . collect :: < Vec < _ > > ( ) ;
98+ expect. assert_debug_eq ( & filtered)
99+ }
100+
101+ #[ track_caller]
102+ pub ( super ) fn check_expect_clear_loc (
103+ config : InlayHintsConfig ,
104+ ra_fixture : & str ,
105+ expect : Expect ,
106+ ) {
107+ let ( analysis, file_id) = fixture:: file ( ra_fixture) ;
108+ let mut inlay_hints = analysis. inlay_hints ( & config, file_id, None ) . unwrap ( ) ;
109+ inlay_hints. iter_mut ( ) . flat_map ( |hint| & mut hint. label . parts ) . for_each ( |hint| {
110+ if let Some ( loc) = & mut hint. linked_location {
111+ loc. range = TextRange :: empty ( TextSize :: from ( 0 ) ) ;
112+ }
113+ } ) ;
114+ let filtered =
115+ inlay_hints. into_iter ( ) . map ( |hint| ( hint. range , hint. label ) ) . collect :: < Vec < _ > > ( ) ;
116+ expect. assert_debug_eq ( & filtered)
117+ }
118+
92119 #[ test]
93120 fn chaining_hints_ignore_comments ( ) {
94121 check_expect (
0 commit comments