tests/test-record.t
changeset 18953 e4ae397595e8
parent 18266 09a2b6741695
child 18954 b1639e98e8a1
--- a/tests/test-record.t	Mon Apr 15 01:22:15 2013 +0900
+++ b/tests/test-record.t	Thu Apr 11 19:03:33 2013 +0200
@@ -1176,6 +1176,53 @@
   +That change will not be committed
   +That is the second line
   +That line has been added
+
+Malformed patch - error handling
+
+  $ cat > editor.sh << '__EOF__'
+  > sed -e '/^@/p' "$1" > tmp
+  > mv tmp "$1"
+  > __EOF__
+  $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg record <<EOF
+  > y
+  > e
+  > EOF
+  diff --git a/editedfile b/editedfile
+  1 hunks, 3 lines changed
+  examine changes to 'editedfile'? [Ynesfdaq?] 
+  @@ -1,3 +1,3 @@
+  -This is the first line
+  -This change will be committed
+  -This is the third line
+  +This change will not be committed
+  +This is the second line
+  +This line has been added
+  record this change to 'editedfile'? [Ynesfdaq?] 
+  abort: error parsing patch: unhandled transition: range -> range
+  [255]
+
+  $ cat > editor.sh << '__EOF__'
+  > sed -e '/^@/iother' "$1" > tmp
+  > mv tmp "$1"
+  > __EOF__
+  $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg record <<EOF
+  > y
+  > e
+  > EOF
+  diff --git a/editedfile b/editedfile
+  1 hunks, 3 lines changed
+  examine changes to 'editedfile'? [Ynesfdaq?] 
+  @@ -1,3 +1,3 @@
+  -This is the first line
+  -This change will be committed
+  -This is the third line
+  +This change will not be committed
+  +This is the second line
+  +This line has been added
+  record this change to 'editedfile'? [Ynesfdaq?] 
+  abort: error parsing patch: unknown patch content: 'other\n'
+  [255]
+
   $ hg up -C
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved