File: check_it

package info (click to toggle)
wdiff 0.5-16etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 576 kB
  • ctags: 274
  • sloc: ansic: 2,391; sh: 327; lisp: 243; makefile: 228
file content (157 lines) | stat: -rwxr-xr-x 5,090 bytes parent folder | download | duplicates (8)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#!/bin/sh
# Check wdiff against some simple test cases.
# Copyright (C) 1992 Free Software Foundation, Inc.

wdiff=./wdiff
input1=/tmp/wd.$$a
input2=/tmp/wd.$$b
expect=/tmp/wd.$$c
output=/tmp/wd.$$d

fail="echo; echo Check FAILED; rm -f $input1 $input2 $expect $output; exit 1"
trap "$fail" 1 2 3 14 15

cat > $input1 <<END_OF_FILE
This is input1
The quick brown fox jumps over the lazy dog.
The hurried orange fox jumps over the lazy dog.
A slow green panda walks around a sleeping cat.
The middling red fox jumps over the lazy dog.
END_OF_FILE

cat > $input2 <<END_OF_FILE
This is input2
The quick brown fox jumps over the lazy dog.
The slow red fox jumps over the lazy dog.
A slow, short green giraffe walks around a sleeping cat.
The middling red fox jumps over the lazy dog.
END_OF_FILE

echo "Checking wdiff"
cat > $expect <<END_OF_FILE
This is [-input1-] {+input2+}
The quick brown fox jumps over the lazy dog.
The [-hurried orange-] {+slow red+} fox jumps over the lazy dog.
A [-slow-] {+slow, short+} green [-panda-] {+giraffe+} walks around a sleeping cat.
The middling red fox jumps over the lazy dog.
END_OF_FILE
$wdiff $input1 $input2 > $output
diff $expect $output || eval "$fail"

echo "Checking wdiff -1"
cat > $expect <<END_OF_FILE
This is {+input2+}
The quick brown fox jumps over the lazy dog.
The {+slow red+} fox jumps over the lazy dog.
A {+slow, short+} green {+giraffe+} walks around a sleeping cat.
The middling red fox jumps over the lazy dog.
END_OF_FILE
$wdiff -1 $input1 $input2 > $output
diff $expect $output || eval "$fail"

echo "Checking wdiff -2"
cat > $expect <<END_OF_FILE
This is [-input1-]
The quick brown fox jumps over the lazy dog.
The [-hurried orange-] fox jumps over the lazy dog.
A [-slow-] green [-panda-] walks around a sleeping cat.
The middling red fox jumps over the lazy dog.
END_OF_FILE
$wdiff -2 $input1 $input2 > $output
diff $expect $output || eval "$fail"

echo "Checking wdiff -3"
cat > $expect <<END_OF_FILE

======================================================================
 [-input1-] {+input2+}
======================================================================
 [-hurried orange-] {+slow red+}
======================================================================
 [-slow-] {+slow, short+}
======================================================================
 [-panda-] {+giraffe+}
======================================================================
END_OF_FILE
$wdiff -3 $input1 $input2 > $output
diff $expect $output || eval "$fail"

echo "Checking wdiff -12"
cat > $expect <<END_OF_FILE
This is
======================================================================

The quick brown fox jumps over the lazy dog.
The
======================================================================
 fox jumps over the lazy dog.
A
======================================================================
 green
======================================================================
 walks around a sleeping cat.
The middling red fox jumps over the lazy dog.
END_OF_FILE
$wdiff -12 $input1 $input2 > $output
diff $expect $output || eval "$fail"

echo "Checking wdiff -13"
cat > $expect <<END_OF_FILE

======================================================================
 input2
======================================================================
 slow red
======================================================================
 slow, short
======================================================================
 giraffe
======================================================================
END_OF_FILE
$wdiff -13 $input1 $input2 > $output
diff $expect $output || eval "$fail"

echo "Checking wdiff -23"
cat > $expect <<END_OF_FILE

======================================================================
 input1
======================================================================
 hurried orange
======================================================================
 slow
======================================================================
 panda
======================================================================
END_OF_FILE
$wdiff -23 $input1 $input2 > $output
diff $expect $output || eval "$fail"

echo "Checking wdiff -123"
cat > $expect <<END_OF_FILE
END_OF_FILE
$wdiff -123 $input1 $input2 > $output
diff $expect $output || eval "$fail"

echo "Checking wdiff -123s"
cat > $expect <<END_OF_FILE
$input1: 39 words  34 87% common  0 0% deleted  5 12% changed
$input2: 40 words  34 85% common  0 0% inserted  6 15% changed
END_OF_FILE
$wdiff -123s $input1 $input2 > $output
diff $expect $output || eval "$fail"

echo "Checking wdiff -wxyz"
cat > $expect <<END_OF_FILE
This is (input1) <<input2>>
The quick brown fox jumps over the lazy dog.
The (hurried orange) <<slow red>> fox jumps over the lazy dog.
A (slow) <<slow, short>> green (panda) <<giraffe>> walks around a sleeping cat.
The middling red fox jumps over the lazy dog.
END_OF_FILE
$wdiff -w\( -x\) -y\<\< -z\>\> $input1 $input2 > $output
diff $expect $output || eval "$fail"

rm -f $input1 $input2 $expect $output
echo
echo All checks successful