remote-helpers: test: cleanup style

So it's more standardized between all the tests. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Felipe Contreras committed May 24, 2013 at 21:29 UTC dde67d794c2600fee74aef289332257742f28cfa
2 files changed +66 -34
contrib/remote-helpers/test-bzr.sh
+58 -30
@@ -18,18 +18,23 @@ if ! python -c 'import bzrlib'; then
18 fi
19
20 check () {
21 - (cd $1 &&
21 + (
22 + cd $1 &&
23 git log --format='%s' -1 &&
23 - git symbolic-ref HEAD) > actual &&
24 - (echo $2 &&
25 - echo "refs/heads/$3") > expected &&
24 + git symbolic-ref HEAD
25 + ) > actual &&
26 + (
27 + echo $2 &&
28 + echo "refs/heads/$3"
29 + ) > expected &&
30 test_cmp expected actual
31 }
32
33 bzr whoami "A U Thor <author@example.com>"
34
35 test_expect_success 'cloning' '
32 - (bzr init bzrrepo &&
36 + (
37 + bzr init bzrrepo &&
38 cd bzrrepo &&
39 echo one > content &&
40 bzr add content &&
@@ -41,7 +46,8 @@ test_expect_success 'cloning' '
46 '
47
48 test_expect_success 'pulling' '
44 - (cd bzrrepo &&
49 + (
50 + cd bzrrepo &&
51 echo two > content &&
52 bzr commit -m two
53 ) &&
@@ -52,7 +58,8 @@ test_expect_success 'pulling' '
58 '
59
60 test_expect_success 'pushing' '
55 - (cd gitrepo &&
61 + (
62 + cd gitrepo &&
63 echo three > content &&
64 git commit -a -m three &&
65 git push
@@ -64,15 +71,18 @@ test_expect_success 'pushing' '
71 '
72
73 test_expect_success 'roundtrip' '
67 - (cd gitrepo &&
74 + (
75 + cd gitrepo &&
76 git pull &&
69 - git log --format="%s" -1 origin/master > actual) &&
77 + git log --format="%s" -1 origin/master > actual
78 + ) &&
79 echo three > expected &&
80 test_cmp expected actual &&
81
82 (cd gitrepo && git push && git pull) &&
83
75 - (cd bzrrepo &&
84 + (
85 + cd bzrrepo &&
86 echo four > content &&
87 bzr commit -m four
88 ) &&
@@ -81,7 +91,8 @@ test_expect_success 'roundtrip' '
91
92 check gitrepo four master &&
93
84 - (cd gitrepo &&
94 + (
95 + cd gitrepo &&
96 echo five > content &&
97 git commit -a -m five &&
98 git push && git pull
@@ -101,7 +112,8 @@ cat > expected <<EOF
112 EOF
113
114 test_expect_success 'special modes' '
104 - (cd bzrrepo &&
115 + (
116 + cd bzrrepo &&
117 echo exec > executable
118 chmod +x executable &&
119 bzr add executable
@@ -111,16 +123,21 @@ test_expect_success 'special modes' '
123 bzr commit -m link &&
124 mkdir dir &&
125 bzr add dir &&
114 - bzr commit -m dir) &&
126 + bzr commit -m dir
127 + ) &&
128
116 - (cd gitrepo &&
129 + (
130 + cd gitrepo &&
131 git pull
118 - git ls-tree HEAD > ../actual) &&
132 + git ls-tree HEAD > ../actual
133 + ) &&
134
135 test_cmp expected actual &&
136
122 - (cd gitrepo &&
123 - git cat-file -p HEAD:link > ../actual) &&
137 + (
138 + cd gitrepo &&
139 + git cat-file -p HEAD:link > ../actual
140 + ) &&
141
142 printf content > expected &&
143 test_cmp expected actual
@@ -134,32 +151,40 @@ cat > expected <<EOF
151 EOF
152
153 test_expect_success 'moving directory' '
137 - (cd bzrrepo &&
154 + (
155 + cd bzrrepo &&
156 mkdir movedir &&
157 echo one > movedir/one &&
158 echo two > movedir/two &&
159 bzr add movedir &&
160 bzr commit -m movedir &&
161 bzr mv movedir movedir-new &&
144 - bzr commit -m movedir-new) &&
162 + bzr commit -m movedir-new
163 + ) &&
164
146 - (cd gitrepo &&
165 + (
166 + cd gitrepo &&
167 git pull &&
148 - git ls-tree HEAD > ../actual) &&
168 + git ls-tree HEAD > ../actual
169 + ) &&
170
171 test_cmp expected actual
172 '
173
174 test_expect_success 'different authors' '
154 - (cd bzrrepo &&
175 + (
176 + cd bzrrepo &&
177 echo john >> content &&
178 bzr commit -m john \
179 --author "Jane Rey <jrey@example.com>" \
158 - --author "John Doe <jdoe@example.com>") &&
180 + --author "John Doe <jdoe@example.com>"
181 + ) &&
182
160 - (cd gitrepo &&
183 + (
184 + cd gitrepo &&
185 git pull &&
162 - git show --format="%an <%ae>, %cn <%ce>" --quiet > ../actual) &&
186 + git show --format="%an <%ae>, %cn <%ce>" --quiet > ../actual
187 + ) &&
188
189 echo "Jane Rey <jrey@example.com>, A U Thor <author@example.com>" > expected &&
190 test_cmp expected actual
@@ -171,6 +196,7 @@ test_expect_success 'fetch utf-8 filenames' '
196
197 LC_ALL=en_US.UTF-8
198 export LC_ALL
199 +
200 (
201 bzr init bzrrepo &&
202 cd bzrrepo &&
@@ -276,23 +302,23 @@ test_expect_success 'proper bzr repo' '
302
303 bzr init-repo bzrrepo &&
304
279 - bzr init bzrrepo/trunk &&
305 (
306 + bzr init bzrrepo/trunk &&
307 cd bzrrepo/trunk &&
308 echo one >> content &&
309 bzr add content &&
310 bzr commit -m one
311 ) &&
312
287 - bzr branch bzrrepo/trunk bzrrepo/branch &&
313 (
314 + bzr branch bzrrepo/trunk bzrrepo/branch &&
315 cd bzrrepo/branch &&
316 echo two >> content &&
317 bzr commit -m one
318 ) &&
319
294 - git clone "bzr::$PWD/bzrrepo" gitrepo &&
320 (
321 + git clone "bzr::$PWD/bzrrepo" gitrepo &&
322 cd gitrepo &&
323 git for-each-ref --format "%(refname:short)" refs/remotes/origin > ../actual
324 ) &&
@@ -331,9 +357,11 @@ test_expect_success 'strip' '
357 bzr log --line | sed -e "s/^[0-9][0-9]*: //" > ../expected
358 ) &&
359
334 - (cd gitrepo &&
360 + (
361 + cd gitrepo &&
362 git fetch &&
336 - git log --format="%an %ad %s" --date=short origin/master > ../actual) &&
363 + git log --format="%an %ad %s" --date=short origin/master > ../actual
364 + ) &&
365
366 test_cmp expected actual
367 '
contrib/remote-helpers/test-hg.sh
+8 -4
@@ -21,11 +21,15 @@ if ! python -c 'import mercurial'; then
21 fi
22
23 check () {
24 - (cd $1 &&
24 + (
25 + cd $1 &&
26 git log --format='%s' -1 &&
26 - git symbolic-ref HEAD) > actual &&
27 - (echo $2 &&
28 - echo "refs/heads/$3") > expected &&
27 + git symbolic-ref HEAD
28 + ) > actual &&
29 + (
30 + echo $2 &&
31 + echo "refs/heads/$3"
32 + ) > expected &&
33 test_cmp expected actual
34 }
35