1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
# Copyright (C) 2009, 2011-2012 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.
. $srcdir/test-lib.sh
require cat
require sed
use_local_patch
use_tmpdir
# ==============================================================
# Line number counting and reporting regression test
cat > a.diff <<EOF
--- a
+++ b
@@ -1 +1 @@
-1
+1b
@@ -3 +3,2 @@
-4
+4b
+4b
@@ -6 +0 @@
-6
+6b
EOF
seq 1 7 > a
check 'patch -f --verbose a < a.diff | grep ^Hunk' <<EOF
Hunk #1 succeeded at 1.
Hunk #2 succeeded at 4 (offset 1 line).
Hunk #3 succeeded at 7.
EOF
check 'cat a' <<EOF
1b
2
3
4b
4b
5
6b
7
EOF
seq 1 7 | sed -e '4d' > a
check 'patch -f --verbose a < a.diff | grep ^Hunk' <<EOF
Hunk #1 succeeded at 1.
Hunk #2 FAILED at 3.
Hunk #3 succeeded at 5 (offset -1 lines).
EOF
check 'cat a' <<EOF
1b
2
3
5
6b
7
EOF
|