@@ -6,7 +6,7 @@ use std::str;
66
77pub ( crate ) struct Patcher < ' a > {
88 edits : Vec < Edit > ,
9- replacer : Option < & ' a Replacer >
9+ replacer : Option < & ' a Replacer > ,
1010}
1111
1212#[ derive( Debug , thiserror:: Error ) ]
@@ -69,37 +69,43 @@ mod tests {
6969
7070 #[ test]
7171 fn patch_bad_number ( ) {
72- let patcher = Patcher :: new ( vec ! [
73- Edit {
74- file: PathBuf :: from( "f" ) ,
75- line_number: 1 ,
76- text: "foo" . to_string( ) ,
77- } ,
78- Edit {
79- file: PathBuf :: from( "f" ) ,
80- line_number: 3 ,
81- text: "bar" . to_string( ) ,
82- } ,
83- ] , None ) ;
72+ let patcher = Patcher :: new (
73+ vec ! [
74+ Edit {
75+ file: PathBuf :: from( "f" ) ,
76+ line_number: 1 ,
77+ text: "foo" . to_string( ) ,
78+ } ,
79+ Edit {
80+ file: PathBuf :: from( "f" ) ,
81+ line_number: 3 ,
82+ text: "bar" . to_string( ) ,
83+ } ,
84+ ] ,
85+ None ,
86+ ) ;
8487 let lines = vec ! [ "a" . to_string( ) , "b" . to_string( ) ] ;
8588 let result = patcher. patch ( lines, false ) ;
8689 assert ! ( matches!( result, Err ( Error :: LineNumber ( 3 ) ) ) ) ;
8790 }
8891
8992 #[ test]
9093 fn patch ( ) {
91- let patcher = Patcher :: new ( vec ! [
92- Edit {
93- file: PathBuf :: from( "f" ) ,
94- line_number: 2 ,
95- text: "foo" . to_string( ) ,
96- } ,
97- Edit {
98- file: PathBuf :: from( "f" ) ,
99- line_number: 3 ,
100- text: "bar" . to_string( ) ,
101- } ,
102- ] , None ) ;
94+ let patcher = Patcher :: new (
95+ vec ! [
96+ Edit {
97+ file: PathBuf :: from( "f" ) ,
98+ line_number: 2 ,
99+ text: "foo" . to_string( ) ,
100+ } ,
101+ Edit {
102+ file: PathBuf :: from( "f" ) ,
103+ line_number: 3 ,
104+ text: "bar" . to_string( ) ,
105+ } ,
106+ ] ,
107+ None ,
108+ ) ;
103109 let lines = vec ! [ "a" . to_string( ) , "b" . to_string( ) , "c" . to_string( ) ] ;
104110 let result = patcher. patch ( lines, false ) ;
105111 assert ! ( result. is_ok( ) ) ;
0 commit comments