File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1026,6 +1026,7 @@ impl Formatter {
10261026 "s\" {}\" " ,
10271027 token
10281028 . to_string( )
1029+ . replace( "\\ " , "\\ \\ " ) // Must be first to avoid double-escaping
10291030 . replace( "\" " , "\\ \" " )
10301031 . replace( "\t " , "\\ t" )
10311032 . replace( "\r " , "\\ r" )
@@ -1870,6 +1871,11 @@ end"#
18701871 "if(test): test # comment else: test2 # comment2" ,
18711872 "if (test): test # comment else: test2 # comment2"
18721873 ) ]
1874+ #[ case:: interpolated_string_with_escaped_brackets(
1875+ r#"s"\\[${phrase}\\]\\(""# ,
1876+ r#"s"\\[${phrase}\\]\\(""#
1877+ ) ]
1878+ #[ case:: interpolated_string_with_backslash( r#"s"\\test""# , r#"s"\\test""# ) ]
18731879 fn test_format ( #[ case] code : & str , #[ case] expected : & str ) {
18741880 let result = Formatter :: new ( None ) . format ( code) ;
18751881 assert_eq ! ( result. unwrap( ) , expected) ;
You can’t perform that action at this time.
0 commit comments