~ubuntu-branches/ubuntu/lucid/patch/lucid

« back to all changes in this revision

Viewing changes to tests/need-filename

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Berg
  • Date: 2009-12-02 10:25:26 UTC
  • mfrom: (5.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20091202102526-5luk0zsqhghu58l2
Tags: 2.6-2
* Update watch file.
* Section: vcs.
* Suggests: diffutils-doc instead of diff-doc, thanks Christoph Anton
  Mitterer for spotting. Closes: #558974.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2009 Free Software Foundation, Inc.
 
2
#
 
3
# Copying and distribution of this file, with or without modification,
 
4
# in any medium, are permitted without royalty provided the copyright
 
5
# notice and this notice are preserved.
 
6
 
 
7
# Don't recognize hunks before a filename has been specified/seen
 
8
 
 
9
. $srcdir/test-lib.sh
 
10
 
 
11
require_cat
 
12
use_local_patch
 
13
use_tmpdir
 
14
 
 
15
# ==============================================================
 
16
 
 
17
cat > n.diff <<EOF
 
18
0a1
 
19
> one
 
20
EOF
 
21
 
 
22
check 'patch < n.diff || echo "Status: $?"' <<EOF
 
23
$PATCH: **** Only garbage was found in the patch input.
 
24
Status: 2
 
25
EOF
 
26
 
 
27
check 'patch -f -n < n.diff || echo "Status: $?"' <<EOF
 
28
can't find file to patch at input line 1
 
29
No file to patch.  Skipping patch.
 
30
1 out of 1 hunk ignored
 
31
Status: 1
 
32
EOF
 
33
 
 
34
touch f
 
35
check 'patch f < n.diff' <<EOF
 
36
patching file f
 
37
EOF
 
38
 
 
39
# ==============================================================
 
40
 
 
41
if ! have_ed ; then
 
42
    echo "The ed utility is not available; skipping ed related tests"
 
43
else
 
44
    cat > e.diff <<EOF
 
45
0a
 
46
one
 
47
.
 
48
EOF
 
49
 
 
50
    check 'patch < e.diff || echo "Status: $?"' <<EOF
 
51
$PATCH: **** Only garbage was found in the patch input.
 
52
Status: 2
 
53
EOF
 
54
 
 
55
    check 'patch -f -e < e.diff || echo "Status: $?"' <<EOF
 
56
can't find file to patch at input line 1
 
57
No file to patch.  Skipping patch.
 
58
Status: 1
 
59
EOF
 
60
 
 
61
    rm -f f
 
62
    touch f
 
63
    ncheck 'patch f < e.diff'
 
64
 
 
65
    check 'cat f' <<EOF
 
66
one
 
67
EOF
 
68
fi
 
69
 
 
70
# ==============================================================
 
71
 
 
72
cat > h+c.diff <<EOF
 
73
*** /dev/null
 
74
--- f
 
75
***************
 
76
*** 0 ****
 
77
--- 1 ----
 
78
+ one
 
79
EOF
 
80
 
 
81
rm -f f
 
82
check 'patch < h+c.diff' <<EOF
 
83
patching file f
 
84
EOF
 
85
 
 
86
check 'cat f' <<EOF
 
87
one
 
88
EOF
 
89
 
 
90
sed -e '1,2d' h+c.diff > c.diff
 
91
 
 
92
check 'patch < c.diff || echo "Status: $?"' <<EOF
 
93
$PATCH: **** Only garbage was found in the patch input.
 
94
Status: 2
 
95
EOF
 
96
 
 
97
rm -f f
 
98
check 'patch f < c.diff' <<EOF
 
99
patching file f
 
100
EOF
 
101
 
 
102
check 'cat f' <<EOF
 
103
one
 
104
EOF
 
105
 
 
106
# ==============================================================
 
107
 
 
108
cat > h+u.diff <<EOF
 
109
--- /dev/null
 
110
+++ f
 
111
@@ -0,0 +1 @@
 
112
+one
 
113
EOF
 
114
 
 
115
rm -f f
 
116
check 'patch < h+u.diff' <<EOF
 
117
patching file f
 
118
EOF
 
119
 
 
120
check 'cat f' <<EOF
 
121
one
 
122
EOF
 
123
 
 
124
sed -e '1,2d' h+u.diff > u.diff
 
125
 
 
126
check 'patch < u.diff || echo "Status: $?"' <<EOF
 
127
$PATCH: **** Only garbage was found in the patch input.
 
128
Status: 2
 
129
EOF
 
130
 
 
131
rm -f f
 
132
check 'patch f < u.diff' <<EOF
 
133
patching file f
 
134
EOF
 
135
 
 
136
check 'cat f' <<EOF
 
137
one
 
138
EOF