190
190
},
191
191
},
192
192
})
193
-
193
+
194
194
testCases = append (testCases , TestCase {
195
195
paths : []string {
196
196
" abcd" ,
207
207
// across platforms.
208
208
newline_ = "\n "
209
209
210
- for _ , testCase := range testCases {
210
+ for _ , testCase := range testCases {
211
211
// Note: Run tests with -v in case of error
212
212
213
213
r , _ := fileActions (testCase .paths , testCase .content )
@@ -312,7 +312,7 @@ func Test_processFileActions(t *testing.T) {
312
312
func Test_processFileActions_noDestinationOverwrite (t * testing.T ) {
313
313
setup (t )
314
314
defer teardown (t )
315
-
315
+
316
316
// Case where a sequence of files such as 0.jpg, 1.jpg is being
317
317
// renamed to 1.jpg, 2.jpg
318
318
@@ -322,7 +322,7 @@ func Test_processFileActions_noDestinationOverwrite(t *testing.T) {
322
322
323
323
filePutContent (p0 , "0" )
324
324
filePutContent (p1 , "1" )
325
-
325
+
326
326
fileActions := []* FileAction {}
327
327
328
328
fileAction := NewFileAction ()
@@ -336,7 +336,7 @@ func Test_processFileActions_noDestinationOverwrite(t *testing.T) {
336
336
fileActions = append (fileActions , fileAction )
337
337
338
338
err := processFileActions (fileActions , false )
339
-
339
+
340
340
if err != nil {
341
341
t .Errorf ("Expected no error, but got an error." )
342
342
}
@@ -365,10 +365,10 @@ func Test_processFileActions_noDestinationOverwrite(t *testing.T) {
365
365
func Test_processFileActions_noDestinationOverwrite2 (t * testing.T ) {
366
366
setup (t )
367
367
defer teardown (t )
368
-
368
+
369
369
// Case where a file is renamed to the name of
370
370
// another existing file.
371
-
371
+
372
372
touch (filepath .Join (tempFolder (), "0" ))
373
373
touch (filepath .Join (tempFolder (), "1" ))
374
374
@@ -380,7 +380,7 @@ func Test_processFileActions_noDestinationOverwrite2(t *testing.T) {
380
380
1
381
381
`
382
382
_ , err := fileActions (originalFilePaths , changes )
383
-
383
+
384
384
if err == nil {
385
385
t .Error ("Expected an error, but got nil." )
386
386
}
@@ -407,7 +407,7 @@ func Test_processFileActions_swapFilenames(t *testing.T) {
407
407
`
408
408
actions , _ := fileActions (originalFilePaths , changes )
409
409
err := processFileActions (actions , false )
410
-
410
+
411
411
if err != nil {
412
412
t .Error ("Expected no error, but got one." )
413
413
}
@@ -421,11 +421,10 @@ func Test_processFileActions_swapFilenames(t *testing.T) {
421
421
}
422
422
}
423
423
424
-
425
424
func Test_processFileActions_renameToSameName (t * testing.T ) {
426
425
setup (t )
427
426
defer teardown (t )
428
-
427
+
429
428
touch (filepath .Join (tempFolder (), "0" ))
430
429
touch (filepath .Join (tempFolder (), "1" ))
431
430
@@ -439,7 +438,7 @@ func Test_processFileActions_renameToSameName(t *testing.T) {
439
438
9
440
439
`
441
440
_ , err := fileActions (originalFilePaths , changes )
442
-
441
+
443
442
if err == nil {
444
443
t .Error ("Expected an error, but got nil." )
445
444
}
@@ -448,7 +447,7 @@ func Test_processFileActions_renameToSameName(t *testing.T) {
448
447
func Test_processFileActions_dontDeleteAfterRename (t * testing.T ) {
449
448
setup (t )
450
449
defer teardown (t )
451
-
450
+
452
451
p0 := filepath .Join (tempFolder (), "0" )
453
452
p1 := filepath .Join (tempFolder (), "1" )
454
453
filePutContent (p0 , "0" )
@@ -465,7 +464,7 @@ func Test_processFileActions_dontDeleteAfterRename(t *testing.T) {
465
464
`
466
465
actions , _ := fileActions (originalFilePaths , changes )
467
466
err := processFileActions (actions , false )
468
-
467
+
469
468
if err != nil {
470
469
t .Error ("Expected no error, but got one." )
471
470
}
0 commit comments