Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit ff86796

Browse files
committed
contrib/remote-helpers: style updates for test scripts
During the review of the main series it was noticed that these test scripts can use updates to conform to our coding style better, but fixing the style should be done in a patch separate from the main series. This updates the test-*.sh scripts only for style issues: * We do not leave SP between a redirection operator and the filename; * We change line before "then", "do", etc. rather than terminating the condition for "if"/"while" and list for "for" with a semicolon; * When HERE document does not use any expansion, we quote the end marker (e.g. "cat <<\EOF" not "cat <<EOF") to signal the readers that there is no funny substitution to worry about when reading the code. * We use "test" rather than "[". Reviewed-by: Michael Haggerty <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c587d65 commit ff86796

File tree

4 files changed

+248
-226
lines changed

4 files changed

+248
-226
lines changed

contrib/remote-helpers/test-bzr.sh

Lines changed: 57 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,21 @@ test_description='Test remote-bzr'
77

88
. ./test-lib.sh
99

10-
if ! test_have_prereq PYTHON; then
10+
if ! test_have_prereq PYTHON
11+
then
1112
skip_all='skipping remote-bzr tests; python not available'
1213
test_done
1314
fi
1415

15-
if ! python -c 'import bzrlib'; then
16+
if ! python -c 'import bzrlib'
17+
then
1618
skip_all='skipping remote-bzr tests; bzr not available'
1719
test_done
1820
fi
1921

2022
check () {
21-
echo $3 > expected &&
22-
git --git-dir=$1/.git log --format='%s' -1 $2 > actual
23+
echo $3 >expected &&
24+
git --git-dir=$1/.git log --format='%s' -1 $2 >actual
2325
test_cmp expected actual
2426
}
2527

@@ -29,7 +31,7 @@ test_expect_success 'cloning' '
2931
(
3032
bzr init bzrrepo &&
3133
cd bzrrepo &&
32-
echo one > content &&
34+
echo one >content &&
3335
bzr add content &&
3436
bzr commit -m one
3537
) &&
@@ -41,7 +43,7 @@ test_expect_success 'cloning' '
4143
test_expect_success 'pulling' '
4244
(
4345
cd bzrrepo &&
44-
echo two > content &&
46+
echo two >content &&
4547
bzr commit -m two
4648
) &&
4749
@@ -53,30 +55,30 @@ test_expect_success 'pulling' '
5355
test_expect_success 'pushing' '
5456
(
5557
cd gitrepo &&
56-
echo three > content &&
58+
echo three >content &&
5759
git commit -a -m three &&
5860
git push
5961
) &&
6062
61-
echo three > expected &&
62-
cat bzrrepo/content > actual &&
63+
echo three >expected &&
64+
cat bzrrepo/content >actual &&
6365
test_cmp expected actual
6466
'
6567

6668
test_expect_success 'roundtrip' '
6769
(
6870
cd gitrepo &&
6971
git pull &&
70-
git log --format="%s" -1 origin/master > actual
72+
git log --format="%s" -1 origin/master >actual
7173
) &&
72-
echo three > expected &&
74+
echo three >expected &&
7375
test_cmp expected actual &&
7476
7577
(cd gitrepo && git push && git pull) &&
7678
7779
(
7880
cd bzrrepo &&
79-
echo four > content &&
81+
echo four >content &&
8082
bzr commit -m four
8183
) &&
8284
@@ -86,19 +88,19 @@ test_expect_success 'roundtrip' '
8688
8789
(
8890
cd gitrepo &&
89-
echo five > content &&
91+
echo five >content &&
9092
git commit -a -m five &&
9193
git push && git pull
9294
) &&
9395
9496
(cd bzrrepo && bzr revert) &&
9597
96-
echo five > expected &&
97-
cat bzrrepo/content > actual &&
98+
echo five >expected &&
99+
cat bzrrepo/content >actual &&
98100
test_cmp expected actual
99101
'
100102

101-
cat > expected <<EOF
103+
cat >expected <<\EOF
102104
100644 blob 54f9d6da5c91d556e6b54340b1327573073030af content
103105
100755 blob 68769579c3eaadbe555379b9c3538e6628bae1eb executable
104106
120000 blob 6b584e8ece562ebffc15d38808cd6b98fc3d97ea link
@@ -107,7 +109,7 @@ EOF
107109
test_expect_success 'special modes' '
108110
(
109111
cd bzrrepo &&
110-
echo exec > executable
112+
echo exec >executable
111113
chmod +x executable &&
112114
bzr add executable
113115
bzr commit -m exec &&
@@ -122,21 +124,21 @@ test_expect_success 'special modes' '
122124
(
123125
cd gitrepo &&
124126
git pull
125-
git ls-tree HEAD > ../actual
127+
git ls-tree HEAD >../actual
126128
) &&
127129
128130
test_cmp expected actual &&
129131
130132
(
131133
cd gitrepo &&
132-
git cat-file -p HEAD:link > ../actual
134+
git cat-file -p HEAD:link >../actual
133135
) &&
134136
135-
printf content > expected &&
137+
printf content >expected &&
136138
test_cmp expected actual
137139
'
138140

139-
cat > expected <<EOF
141+
cat >expected <<\EOF
140142
100644 blob 54f9d6da5c91d556e6b54340b1327573073030af content
141143
100755 blob 68769579c3eaadbe555379b9c3538e6628bae1eb executable
142144
120000 blob 6b584e8ece562ebffc15d38808cd6b98fc3d97ea link
@@ -147,8 +149,8 @@ test_expect_success 'moving directory' '
147149
(
148150
cd bzrrepo &&
149151
mkdir movedir &&
150-
echo one > movedir/one &&
151-
echo two > movedir/two &&
152+
echo one >movedir/one &&
153+
echo two >movedir/two &&
152154
bzr add movedir &&
153155
bzr commit -m movedir &&
154156
bzr mv movedir movedir-new &&
@@ -158,7 +160,7 @@ test_expect_success 'moving directory' '
158160
(
159161
cd gitrepo &&
160162
git pull &&
161-
git ls-tree HEAD > ../actual
163+
git ls-tree HEAD >../actual
162164
) &&
163165
164166
test_cmp expected actual
@@ -167,7 +169,7 @@ test_expect_success 'moving directory' '
167169
test_expect_success 'different authors' '
168170
(
169171
cd bzrrepo &&
170-
echo john >> content &&
172+
echo john >>content &&
171173
bzr commit -m john \
172174
--author "Jane Rey <[email protected]>" \
173175
--author "John Doe <[email protected]>"
@@ -176,10 +178,10 @@ test_expect_success 'different authors' '
176178
(
177179
cd gitrepo &&
178180
git pull &&
179-
git show --format="%an <%ae>, %cn <%ce>" --quiet > ../actual
181+
git show --format="%an <%ae>, %cn <%ce>" --quiet >../actual
180182
) &&
181183
182-
echo "Jane Rey <[email protected]>, A U Thor <[email protected]>" > expected &&
184+
echo "Jane Rey <[email protected]>, A U Thor <[email protected]>" >expected &&
183185
test_cmp expected actual
184186
'
185187

@@ -196,12 +198,12 @@ test_expect_success 'fetch utf-8 filenames' '
196198
bzr init bzrrepo &&
197199
cd bzrrepo &&
198200
199-
echo test >> "ærø" &&
201+
echo test >>"ærø" &&
200202
bzr add "ærø" &&
201-
echo test >> "ø~?" &&
203+
echo test >>"ø~?" &&
202204
bzr add "ø~?" &&
203205
bzr commit -m add-utf-8 &&
204-
echo test >> "ærø" &&
206+
echo test >>"ærø" &&
205207
bzr commit -m test-utf-8 &&
206208
bzr rm "ø~?" &&
207209
bzr mv "ærø" "ø~?" &&
@@ -211,9 +213,9 @@ test_expect_success 'fetch utf-8 filenames' '
211213
(
212214
git clone "bzr::bzrrepo" gitrepo &&
213215
cd gitrepo &&
214-
git -c core.quotepath=false ls-files > ../actual
216+
git -c core.quotepath=false ls-files >../actual
215217
) &&
216-
echo "ø~?" > expected &&
218+
echo "ø~?" >expected &&
217219
test_cmp expected actual
218220
'
219221

@@ -229,7 +231,7 @@ test_expect_success 'push utf-8 filenames' '
229231
bzr init bzrrepo &&
230232
cd bzrrepo &&
231233
232-
echo one >> content &&
234+
echo one >>content &&
233235
bzr add content &&
234236
bzr commit -m one
235237
) &&
@@ -238,15 +240,15 @@ test_expect_success 'push utf-8 filenames' '
238240
git clone "bzr::bzrrepo" gitrepo &&
239241
cd gitrepo &&
240242
241-
echo test >> "ærø" &&
243+
echo test >>"ærø" &&
242244
git add "ærø" &&
243245
git commit -m utf-8 &&
244246
245247
git push
246248
) &&
247249
248-
(cd bzrrepo && bzr ls > ../actual) &&
249-
printf "content\nærø\n" > expected &&
250+
(cd bzrrepo && bzr ls >../actual) &&
251+
printf "content\nærø\n" >expected &&
250252
test_cmp expected actual
251253
'
252254

@@ -256,7 +258,7 @@ test_expect_success 'pushing a merge' '
256258
(
257259
bzr init bzrrepo &&
258260
cd bzrrepo &&
259-
echo one > content &&
261+
echo one >content &&
260262
bzr add content &&
261263
bzr commit -m one
262264
) &&
@@ -265,27 +267,27 @@ test_expect_success 'pushing a merge' '
265267
266268
(
267269
cd bzrrepo &&
268-
echo two > content &&
270+
echo two >content &&
269271
bzr commit -m two
270272
) &&
271273
272274
(
273275
cd gitrepo &&
274-
echo three > content &&
276+
echo three >content &&
275277
git commit -a -m three &&
276278
git fetch &&
277279
git merge origin/master || true &&
278-
echo three > content &&
280+
echo three >content &&
279281
git commit -a --no-edit &&
280282
git push
281283
) &&
282284
283-
echo three > expected &&
284-
cat bzrrepo/content > actual &&
285+
echo three >expected &&
286+
cat bzrrepo/content >actual &&
285287
test_cmp expected actual
286288
'
287289

288-
cat > expected <<EOF
290+
cat >expected <<\EOF
289291
origin/HEAD
290292
origin/branch
291293
origin/trunk
@@ -299,22 +301,22 @@ test_expect_success 'proper bzr repo' '
299301
(
300302
bzr init bzrrepo/trunk &&
301303
cd bzrrepo/trunk &&
302-
echo one >> content &&
304+
echo one >>content &&
303305
bzr add content &&
304306
bzr commit -m one
305307
) &&
306308
307309
(
308310
bzr branch bzrrepo/trunk bzrrepo/branch &&
309311
cd bzrrepo/branch &&
310-
echo two >> content &&
312+
echo two >>content &&
311313
bzr commit -m one
312314
) &&
313315
314316
(
315317
git clone "bzr::bzrrepo" gitrepo &&
316318
cd gitrepo &&
317-
git for-each-ref --format "%(refname:short)" refs/remotes/origin > ../actual
319+
git for-each-ref --format "%(refname:short)" refs/remotes/origin >../actual
318320
) &&
319321
320322
test_cmp expected actual
@@ -327,11 +329,11 @@ test_expect_success 'strip' '
327329
bzr init bzrrepo &&
328330
cd bzrrepo &&
329331
330-
echo one >> content &&
332+
echo one >>content &&
331333
bzr add content &&
332334
bzr commit -m one &&
333335
334-
echo two >> content &&
336+
echo two >>content &&
335337
bzr commit -m two
336338
) &&
337339
@@ -341,18 +343,18 @@ test_expect_success 'strip' '
341343
cd bzrrepo &&
342344
bzr uncommit --force &&
343345
344-
echo three >> content &&
346+
echo three >>content &&
345347
bzr commit -m three &&
346348
347-
echo four >> content &&
349+
echo four >>content &&
348350
bzr commit -m four &&
349-
bzr log --line | sed -e "s/^[0-9][0-9]*: //" > ../expected
351+
bzr log --line | sed -e "s/^[0-9][0-9]*: //" >../expected
350352
) &&
351353
352354
(
353355
cd gitrepo &&
354356
git fetch &&
355-
git log --format="%an %ad %s" --date=short origin/master > ../actual
357+
git log --format="%an %ad %s" --date=short origin/master >../actual
356358
) &&
357359
358360
test_cmp expected actual
@@ -372,7 +374,7 @@ test_expect_success 'export utf-8 authors' '
372374
(
373375
git init gitrepo &&
374376
cd gitrepo &&
375-
echo greg >> content &&
377+
echo greg >>content &&
376378
git add content &&
377379
git commit -m one &&
378380
git remote add bzr "bzr::../bzrrepo" &&
@@ -381,10 +383,10 @@ test_expect_success 'export utf-8 authors' '
381383
382384
(
383385
cd bzrrepo &&
384-
bzr log | grep "^committer: " > ../actual
386+
bzr log | grep "^committer: " >../actual
385387
) &&
386388
387-
echo "committer: Grégoire <[email protected]>" > expected &&
389+
echo "committer: Grégoire <[email protected]>" >expected &&
388390
test_cmp expected actual
389391
'
390392

0 commit comments

Comments
 (0)