@@ -319,48 +319,48 @@ where
319319
320320#[ test]
321321fn git_diff_test ( ) {
322- let before = r#"struct Rectangle {
323- width: u32 ,
324- height: u32 ,
322+ let before = r#"struct SomeStruct {
323+ field1: f64 ,
324+ field2: f64 ,
325325}
326326
327327fn main() {
328- // width and height of a rectangle can be different
329- let rect1 = Rectangle { width: 30, height: 50 };
328+ // Some comment
329+ let c = SomeStruct { field1: 10.0, field2: 10.0 };
330330
331331 println!(
332- "The area of the rectangle is {} square pixels. ",
333- area(&rect1 )
332+ "Print field1 from SomeStruct {} ",
333+ get_field1(&c )
334334 );
335335}
336336
337- fn area(rectangle : &Rectangle ) -> u32 {
338- rectangle.width * rectangle.height
337+ fn get_field1(c : &SomeStruct ) -> f64 {
338+ c.field1
339339}
340340"# ;
341341
342- let after = r#"/// A rectangle. First line is changed to prevent a regression of #1869
343- struct Rectangle {
344- width: u32 ,
345- height: u32 ,
342+ let after = r#"/// This is a struct
343+ struct SomeStruct {
344+ field1: f64 ,
345+ field2: f64 ,
346346}
347347
348348fn main() {
349- let rect1 = Rectangle { width: 30, height: 50 };
349+ let c = SomeStruct { field1: 10.0, field2: 10.0 };
350350
351351 println!(
352- "The perimeter of the rectangle is {} pixels. ",
353- perimeter(&rect1 )
352+ "Print field1 and field2 from SomeStruct {} {} ",
353+ get_field1(&c), get_field2(&c )
354354 );
355- println!("This line contains invalid utf8" ;
355+ println!("Print another line") ;
356356}
357357
358- fn area(rectangle : &Rectangle ) -> u32 {
359- rectangle.width * rectangle.height
358+ fn get_field1(c : &SomeStruct ) -> f64 {
359+ c.field1
360360}
361361
362- fn perimeter(rectangle : &Rectangle ) -> u32 {
363- (rectangle.width + rectangle.height) * 2
362+ fn get_field2(c : &SomeStruct ) -> f64 {
363+ c.field2
364364}
365365"# ;
366366 use crate :: blob:: git_diff:: ChangeKind ;
0 commit comments