Skip to content

Commit

Permalink
Repro case for when a unified patch has no prefix (#10877)
Browse files Browse the repository at this point in the history
Signed-off-by: Marek Kubica <marek@tarides.com>
  • Loading branch information
Leonidas-from-XIV authored Sep 4, 2024
1 parent f034d16 commit 07e4354
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/expect-tests/dune_patch/dune_patch_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ diff -u a/foo.ml b/foo.ml
|}
;;

let no_prefix =
{|
--- foo.ml 2024-08-29 17:37:53.114980665 +0200
+++ foo.ml 2024-08-29 17:38:00.243088256 +0200
@@ -1 +1 @@
-This is wrong
+This is right
|}
;;

(* Testing the patch action *)

include struct
Expand Down Expand Up @@ -171,3 +181,15 @@ let%expect_test "Using a patch from 'diff' with a timestamp" =
then [%expect ""]
else [%expect.unreachable]
;;

let%expect_test "patching a file without prefix" =
test [ "foo.ml", "This is wrong\n" ] ("foo.patch", no_prefix);
check "foo.ml";
[%expect.unreachable]
[@@expect.uncaught_exn
{|
(Dune_util__Report_error.Already_reported)
Trailing output
---------------
Command exited with code 1. |}]
;;

0 comments on commit 07e4354

Please sign in to comment.