@@ -19,7 +19,7 @@ func TestSvnRepo(t *testing.T) {
19
19
20
20
tempDir , err := ioutil .TempDir ("" , "go-vcs-svn-tests" )
21
21
if err != nil {
22
- t .Error (err )
22
+ t .Fatal (err )
23
23
}
24
24
defer func () {
25
25
err = os .RemoveAll (tempDir )
@@ -30,54 +30,54 @@ func TestSvnRepo(t *testing.T) {
30
30
31
31
rep , err := vcs .NewSvnRepo ("https://github.com/Masterminds/VCSTestRepo/trunk" , tempDir + string (os .PathSeparator )+ "VCSTestRepo" )
32
32
if err != nil {
33
- t .Error (err )
33
+ t .Fatal (err )
34
34
}
35
35
repo := & svnRepo {rep }
36
36
37
37
// Do an initial checkout.
38
38
err = repo .Get ()
39
39
if err != nil {
40
- t .Errorf ("Unable to checkout SVN repo. Err was %s " , err )
40
+ t .Fatalf ("Unable to checkout SVN repo. Err was %#v " , err )
41
41
}
42
42
43
43
// Verify SVN repo is a SVN repo
44
44
if ! repo .CheckLocal () {
45
- t .Error ("Problem checking out repo or SVN CheckLocal is not working" )
45
+ t .Fatal ("Problem checking out repo or SVN CheckLocal is not working" )
46
46
}
47
47
48
48
// Update the version to a previous version.
49
49
err = repo .UpdateVersion ("r2" )
50
50
if err != nil {
51
- t .Errorf ("Unable to update SVN repo version. Err was %s" , err )
51
+ t .Fatalf ("Unable to update SVN repo version. Err was %s" , err )
52
52
}
53
53
54
54
// Use Version to verify we are on the right version.
55
55
v , err := repo .Version ()
56
- if v != "2" {
57
- t .Error ("Error checking checked SVN out version" )
58
- }
59
56
if err != nil {
60
- t .Error (err )
57
+ t .Fatal (err )
58
+ }
59
+ if v != "2" {
60
+ t .Fatal ("Error checking checked SVN out version" )
61
61
}
62
62
63
63
// Perform an update which should take up back to the latest version.
64
64
err = repo .Update ()
65
65
if err != nil {
66
- t .Error (err )
66
+ t .Fatal (err )
67
67
}
68
68
69
69
// Make sure we are on a newer version because of the update.
70
70
v , err = repo .Version ()
71
- if v == "2" {
72
- t .Error ("Error with version. Still on old version. Update failed" )
73
- }
74
71
if err != nil {
75
- t .Error (err )
72
+ t .Fatal (err )
73
+ }
74
+ if v == "2" {
75
+ t .Fatal ("Error with version. Still on old version. Update failed" )
76
76
}
77
77
78
78
ci , err := repo .CommitInfo ("2" )
79
79
if err != nil {
80
- t .Error (err )
80
+ t .Fatal (err )
81
81
}
82
82
if ci .Commit != "2" {
83
83
t .Error ("Svn.CommitInfo wrong commit id" )
@@ -90,7 +90,7 @@ func TestSvnRepo(t *testing.T) {
90
90
}
91
91
ti , err := time .Parse (time .RFC3339Nano , "2015-07-29T13:46:20.000000Z" )
92
92
if err != nil {
93
- t .Error (err )
93
+ t .Fatal (err )
94
94
}
95
95
if ! ti .Equal (ci .Date ) {
96
96
t .Error ("Svn.CommitInfo wrong date" )
@@ -109,7 +109,7 @@ func TestHgRepo(t *testing.T) {
109
109
110
110
tempDir , err := ioutil .TempDir ("" , "go-vcs-hg-tests" )
111
111
if err != nil {
112
- t .Error (err )
112
+ t .Fatal (err )
113
113
}
114
114
115
115
defer func () {
@@ -121,49 +121,49 @@ func TestHgRepo(t *testing.T) {
121
121
122
122
rep , err := vcs .NewHgRepo ("https://bitbucket.org/mattfarina/testhgrepo" , tempDir + "/testhgrepo" )
123
123
if err != nil {
124
- t .Error (err )
124
+ t .Fatal (err )
125
125
}
126
126
127
127
repo := & hgRepo {rep }
128
128
129
129
// Do an initial clone.
130
130
err = repo .Get ()
131
131
if err != nil {
132
- t .Errorf ("Unable to clone Hg repo. Err was %s" , err )
132
+ t .Fatalf ("Unable to clone Hg repo. Err was %s" , err )
133
133
}
134
134
135
135
// Verify Hg repo is a Hg repo
136
136
if ! repo .CheckLocal () {
137
- t .Error ("Problem checking out repo or Hg CheckLocal is not working" )
137
+ t .Fatal ("Problem checking out repo or Hg CheckLocal is not working" )
138
138
}
139
139
140
140
// Set the version using the short hash.
141
141
err = repo .UpdateVersion ("a5494ba2177f" )
142
142
if err != nil {
143
- t .Errorf ("Unable to update Hg repo version. Err was %s" , err )
143
+ t .Fatalf ("Unable to update Hg repo version. Err was %s" , err )
144
144
}
145
145
146
146
// Use Version to verify we are on the right version.
147
147
v , err := repo .Version ()
148
- if v != "a5494ba2177ff9ef26feb3c155dfecc350b1a8ef" {
149
- t .Errorf ("Error checking checked out Hg version: %s" , v )
150
- }
151
148
if err != nil {
152
- t .Error (err )
149
+ t .Fatal (err )
150
+ }
151
+ if v != "a5494ba2177ff9ef26feb3c155dfecc350b1a8ef" {
152
+ t .Fatalf ("Error checking checked out Hg version: %s" , v )
153
153
}
154
154
155
155
// Perform an update.
156
156
err = repo .Update ()
157
157
if err != nil {
158
- t .Error (err )
158
+ t .Fatal (err )
159
159
}
160
160
161
161
v , err = repo .Version ()
162
162
if v != "9c6ccbca73e8a1351c834f33f57f1f7a0329ad35" {
163
- t .Errorf ("Error checking checked out Hg version: %s" , v )
163
+ t .Fatalf ("Error checking checked out Hg version: %s" , v )
164
164
}
165
165
if err != nil {
166
- t .Error (err )
166
+ t .Fatal (err )
167
167
}
168
168
}
169
169
@@ -174,7 +174,7 @@ func TestGitRepo(t *testing.T) {
174
174
175
175
tempDir , err := ioutil .TempDir ("" , "go-vcs-git-tests" )
176
176
if err != nil {
177
- t .Error (err )
177
+ t .Fatal (err )
178
178
}
179
179
180
180
defer func () {
@@ -186,40 +186,40 @@ func TestGitRepo(t *testing.T) {
186
186
187
187
rep , err := vcs .NewGitRepo ("https://github.com/Masterminds/VCSTestRepo" , tempDir + "/VCSTestRepo" )
188
188
if err != nil {
189
- t .Error (err )
189
+ t .Fatal (err )
190
190
}
191
191
192
192
repo := & gitRepo {rep }
193
193
194
194
// Do an initial clone.
195
195
err = repo .Get ()
196
196
if err != nil {
197
- t .Errorf ("Unable to clone Git repo. Err was %s" , err )
197
+ t .Fatalf ("Unable to clone Git repo. Err was %s" , err )
198
198
}
199
199
200
200
// Verify Git repo is a Git repo
201
201
if ! repo .CheckLocal () {
202
- t .Error ("Problem checking out repo or Git CheckLocal is not working" )
202
+ t .Fatal ("Problem checking out repo or Git CheckLocal is not working" )
203
203
}
204
204
205
205
// Perform an update.
206
206
err = repo .Update ()
207
207
if err != nil {
208
- t .Error (err )
208
+ t .Fatal (err )
209
209
}
210
210
211
211
v , err := repo .Current ()
212
212
if err != nil {
213
- t .Errorf ("Error trying Git Current: %s" , err )
213
+ t .Fatalf ("Error trying Git Current: %s" , err )
214
214
}
215
215
if v != "master" {
216
- t .Errorf ("Current failed to detect Git on tip of master. Got version: %s" , v )
216
+ t .Fatalf ("Current failed to detect Git on tip of master. Got version: %s" , v )
217
217
}
218
218
219
219
// Set the version using the short hash.
220
220
err = repo .UpdateVersion ("806b07b" )
221
221
if err != nil {
222
- t .Errorf ("Unable to update Git repo version. Err was %s" , err )
222
+ t .Fatalf ("Unable to update Git repo version. Err was %s" , err )
223
223
}
224
224
225
225
// Once a ref has been checked out the repo is in a detached head state.
@@ -228,16 +228,16 @@ func TestGitRepo(t *testing.T) {
228
228
// skipping that here.
229
229
err = repo .Update ()
230
230
if err != nil {
231
- t .Error (err )
231
+ t .Fatal (err )
232
232
}
233
233
234
234
// Use Version to verify we are on the right version.
235
235
v , err = repo .Version ()
236
- if v != "806b07b08faa21cfbdae93027904f80174679402" {
237
- t .Error ("Error checking checked out Git version" )
238
- }
239
236
if err != nil {
240
- t .Error (err )
237
+ t .Fatal (err )
238
+ }
239
+ if v != "806b07b08faa21cfbdae93027904f80174679402" {
240
+ t .Fatal ("Error checking checked out Git version" )
241
241
}
242
242
}
243
243
@@ -248,7 +248,7 @@ func TestBzrRepo(t *testing.T) {
248
248
249
249
tempDir , err := ioutil .TempDir ("" , "go-vcs-bzr-tests" )
250
250
if err != nil {
251
- t .Error (err )
251
+ t .Fatal (err )
252
252
}
253
253
254
254
defer func () {
@@ -268,41 +268,41 @@ func TestBzrRepo(t *testing.T) {
268
268
// Do an initial clone.
269
269
err = repo .Get ()
270
270
if err != nil {
271
- t .Errorf ("Unable to clone Bzr repo. Err was %s" , err )
271
+ t .Fatalf ("Unable to clone Bzr repo. Err was %s" , err )
272
272
}
273
273
274
274
// Verify Bzr repo is a Bzr repo
275
275
if ! repo .CheckLocal () {
276
- t .Error ("Problem checking out repo or Bzr CheckLocal is not working" )
276
+ t .Fatal ("Problem checking out repo or Bzr CheckLocal is not working" )
277
277
}
278
278
279
279
v , err := repo .Current ()
280
280
if err != nil {
281
- t .Errorf ("Error trying Bzr Current: %s" , err )
281
+ t .Fatalf ("Error trying Bzr Current: %s" , err )
282
282
}
283
283
if v != "-1" {
284
- t .Errorf ("Current failed to detect Bzr on tip of branch. Got version: %s" , v )
284
+ t .Fatalf ("Current failed to detect Bzr on tip of branch. Got version: %s" , v )
285
285
}
286
286
287
287
err = repo .UpdateVersion ("2" )
288
288
if err != nil {
289
- t .Errorf ("Unable to update Bzr repo version. Err was %s" , err )
289
+ t .Fatalf ("Unable to update Bzr repo version. Err was %s" , err )
290
290
}
291
291
292
292
// Use Version to verify we are on the right version.
293
293
v , err = repo .Version ()
294
- if v != "2" {
295
- t .Error ("Error checking checked out Bzr version" )
296
- }
297
294
if err != nil {
298
- t .Error (err )
295
+ t .Fatal (err )
296
+ }
297
+ if v != "2" {
298
+ t .Fatal ("Error checking checked out Bzr version" )
299
299
}
300
300
301
301
v , err = repo .Current ()
302
302
if err != nil {
303
- t .Errorf ("Error trying Bzr Current: %s" , err )
303
+ t .Fatalf ("Error trying Bzr Current: %s" , err )
304
304
}
305
305
if v != "2" {
306
- t .Errorf ("Current failed to detect Bzr on rev 2 of branch. Got version: %s" , v )
306
+ t .Fatalf ("Current failed to detect Bzr on rev 2 of branch. Got version: %s" , v )
307
307
}
308
308
}
0 commit comments