summaryrefslogtreecommitdiff
path: root/tests/no-newline-triggers-assert
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2009-03-14 00:09:04 +0100
committerAndreas Gruenbacher <agruen@suse.de>2009-03-22 13:38:25 +0100
commit17a7d6db47e5529d5c92bb075cb7872e0029499b (patch)
tree8951990290acf0c80a31b780ed405556ebe8f964 /tests/no-newline-triggers-assert
parent65b2c8db1c58897b79eadacbeca8a63c30b82d38 (diff)
downloadpatch-17a7d6db47e5529d5c92bb075cb7872e0029499b.tar.gz
Wrong assertion in savebuf
Patch fails with "Assertion `s && size' failed" when it sees a zero-length line. However, as the test case shows, a zero- length line can occur as the last line of a patch. Reported by Clarence Dang <clarencedang@users.sourceforge.net>.
Diffstat (limited to 'tests/no-newline-triggers-assert')
-rwxr-xr-xtests/no-newline-triggers-assert37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/no-newline-triggers-assert b/tests/no-newline-triggers-assert
new file mode 100755
index 0000000..72e9464
--- /dev/null
+++ b/tests/no-newline-triggers-assert
@@ -0,0 +1,37 @@
+#! /bin/bash
+
+# Copyright (C) 2009 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# in any medium, are permitted without royalty provided the copyright
+# notice and this notice are preserved.
+
+# Regression test for Assertion `s && size' failed in savebuf
+
+. $srcdir/test-lib.sh
+
+require_cat
+require_diff
+use_local_patch
+use_tmpdir
+
+# ==============================================================
+
+echo one > f
+
+cat > f.diff <<EOF
+--- f
++++ f
+@@ -1,2 +1,2 @@
+-1
++1a
+
+\ No newline at end of file
+EOF
+
+echo 1 > f
+
+check 'patch -p0 < f.diff' <<EOF
+patching file f
+Hunk #1 succeeded at 1 with fuzz 1.
+EOF