297297]
298298
299299let basic_parse diff exp () =
300- let diffs = Patch. to_diffs diff in
300+ let diffs = Patch. to_diffs ~p: 0 diff in
301301 Alcotest. (check (list test_t) __LOC__ exp diffs)
302302
303303let parse_diffs =
@@ -306,7 +306,7 @@ let parse_diffs =
306306 (List. combine basic_diffs basic_hunks)
307307
308308let basic_apply file diff exp () =
309- match Patch. to_diffs diff with
309+ match Patch. to_diffs ~p: 0 diff with
310310 | [ diff ] ->
311311 let res = Patch. patch file diff in
312312 Alcotest. (check (option string ) __LOC__ exp res)
@@ -369,7 +369,7 @@ let multi_files = [ Some "bar" ; Some "baz" ; None ; Some "foobarbaz" ]
369369let multi_exp = [ Some " foobar" ; None ; Some " baz" ; Some " foobar" ]
370370
371371let multi_apply () =
372- let diffs = Patch. to_diffs multi_diff in
372+ let diffs = Patch. to_diffs ~p: 0 multi_diff in
373373 Alcotest. (check int __LOC__ (List. length multi_files) (List. length diffs));
374374 Alcotest. (check int __LOC__ (List. length multi_exp) (List. length diffs));
375375 List. iter2 (fun diff (input , expected ) ->
@@ -400,7 +400,7 @@ let op_test = Alcotest.testable (Patch.pp_operation ~git:false) Patch.operation_
400400
401401let parse_real_diff_header file hdr () =
402402 let data = read (file ^ " .diff" ) in
403- let diffs = Patch. to_diffs data in
403+ let diffs = Patch. to_diffs ~p: 0 data in
404404 Alcotest. (check int __LOC__ 1 (List. length diffs));
405405 Alcotest. check op_test __LOC__ hdr (List. hd diffs).Patch. operation
406406
@@ -409,17 +409,17 @@ let parse_real_diff_headers =
409409 " parsing " ^ file ^ " .diff" , `Quick , parse_real_diff_header file hdr)
410410 [ " first" , Patch. Rename (" first.old" , " first.new" ) ;
411411 " create1" , Patch. Create " a/create1" ;
412- " git1" , Patch. Create " git1.new" ;
412+ " git1" , Patch. Create " b/ git1.new" ;
413413 " git2" , Patch. Rename_only (" git2.old" , " git2.new" ) ;
414- " git3" , Patch. Rename (" git3.old" , " git3.new" ) ;
415- " git4" , Patch. Delete " git4.old"
414+ " git3" , Patch. Rename (" a/ git3.old" , " b/ git3.new" ) ;
415+ " git4" , Patch. Delete " a/ git4.old"
416416 ]
417417
418418let regression_test name () =
419419 let old = opt_read (name ^ " .old" ) in
420420 let diff = read (name ^ " .diff" ) in
421421 let exp = opt_read (name ^ " .new" ) in
422- match Patch. to_diffs diff with
422+ match Patch. to_diffs ~p: 0 diff with
423423 | [ diff ] ->
424424 let res = Patch. patch old diff in
425425 Alcotest. (check (option string ) __LOC__ exp res)
0 commit comments