File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -5015,3 +5015,52 @@ help: consider importing this module
50155015 let renderer = renderer. decor_style ( DecorStyle :: Unicode ) ;
50165016 assert_data_eq ! ( renderer. render( input) , expected_unicode) ;
50175017}
5018+
5019+ #[ test]
5020+ fn original_matches_replacement_suffix ( ) {
5021+ let source = r#"use sync;"# ;
5022+ let input = & [
5023+ Group :: with_level ( Level :: ERROR ) . element (
5024+ Snippet :: source ( source) . path ( "/tmp/test.rs" ) . annotation (
5025+ AnnotationKind :: Primary
5026+ . span ( 4 ..8 )
5027+ . label ( "no `sync` in the root" ) ,
5028+ ) ,
5029+ ) ,
5030+ Level :: HELP
5031+ . secondary_title ( "consider importing this module instead" )
5032+ . element (
5033+ Snippet :: source ( source)
5034+ . path ( "/tmp/test.rs" )
5035+ . patch ( Patch :: new ( 4 ..8 , "std::sync" ) ) ,
5036+ ) ,
5037+ ] ;
5038+
5039+ let expected_ascii = str![ [ r#"
5040+ --> /tmp/test.rs:1:5
5041+ |
5042+ 1 | use sync;
5043+ | ^^^^ no `sync` in the root
5044+ |
5045+ help: consider importing this module instead
5046+ |
5047+ 1 | use std::sync;
5048+ | +++++
5049+ "# ] ] ;
5050+ let renderer = Renderer :: plain ( ) ;
5051+ assert_data_eq ! ( renderer. render( input) , expected_ascii) ;
5052+
5053+ let expected_unicode = str![ [ r#"
5054+ ╭▸ /tmp/test.rs:1:5
5055+ │
5056+ 1 │ use sync;
5057+ │ ━━━━ no `sync` in the root
5058+ ╰╴
5059+ help: consider importing this module instead
5060+ ╭╴
5061+ 1 │ use std::sync;
5062+ ╰╴ +++++
5063+ "# ] ] ;
5064+ let renderer = renderer. decor_style ( DecorStyle :: Unicode ) ;
5065+ assert_data_eq ! ( renderer. render( input) , expected_unicode) ;
5066+ }
You can’t perform that action at this time.
0 commit comments