@@ -6,10 +6,11 @@ import (
6
6
"math"
7
7
"reflect"
8
8
"runtime"
9
+ "sort"
9
10
"strings"
10
11
"testing"
11
- "sort"
12
- ".. /tester"
12
+
13
+ "github.com/mongodb-forks/go-difflib/difflib /tester"
13
14
)
14
15
15
16
func assertAlmostEqual (t * testing.T , a , b float64 , places int ) {
@@ -35,15 +36,15 @@ func splitChars(s string) [][]byte {
35
36
36
37
func stringsToBytes (in ... string ) (out [][]byte ) {
37
38
out = make ([][]byte , len (in ))
38
- for i , s := range ( in ) {
39
+ for i , s := range in {
39
40
out [i ] = []byte (s )
40
41
}
41
42
return
42
43
}
43
44
44
45
func bytesToStrings (in ... []byte ) (out []string ) {
45
46
out = make ([]string , len (in ))
46
- for i , s := range ( in ) {
47
+ for i , s := range in {
47
48
out [i ] = string (s )
48
49
}
49
50
return
@@ -332,7 +333,7 @@ func TestOutputFormatRangeFormatUnified(t *testing.T) {
332
333
// If a range is empty, its beginning line number shall be the number of
333
334
// the line just before the range, or 0 if the empty range starts the file.
334
335
fmt := formatRangeUnified
335
- fm := func (a , b int ) string { return string (fmt (a ,b )) }
336
+ fm := func (a , b int ) string { return string (fmt (a , b )) }
336
337
assertEqual (t , fm (3 , 3 ), "3,0" )
337
338
assertEqual (t , fm (3 , 4 ), "4" )
338
339
assertEqual (t , fm (3 , 5 ), "4,2" )
@@ -357,7 +358,7 @@ func TestOutputFormatRangeFormatContext(t *testing.T) {
357
358
// and the following format otherwise:
358
359
// "--- %d ----\n", <ending line number>
359
360
fmt := formatRangeContext
360
- fm := func (a , b int ) string { return string (fmt (a ,b )) }
361
+ fm := func (a , b int ) string { return string (fmt (a , b )) }
361
362
assertEqual (t , fm (3 , 3 ), "3" )
362
363
assertEqual (t , fm (3 , 4 ), "4" )
363
364
assertEqual (t , fm (3 , 5 ), "4,5" )
@@ -476,7 +477,7 @@ func BenchmarkSplitLines10000(b *testing.B) {
476
477
477
478
func prepareFilesToDiff (count , seed int ) (As , Bs [][][]byte ) {
478
479
defer runtime .GC ()
479
- aux := func () { // to ensure temp variables go out of scope
480
+ aux := func () { // to ensure temp variables go out of scope
480
481
stringsA , stringsB := tester .PrepareStringsToDiff (count , seed )
481
482
As = make ([][][]byte , len (stringsA ))
482
483
Bs = make ([][][]byte , len (stringsB ))
@@ -547,7 +548,7 @@ func TestDifferStructuredDump(t *testing.T) {
547
548
stringsToBytes ("foo" , "bar" , "baz" , "quux" , "qwerty" ),
548
549
1 , 3 )
549
550
expected := []DiffLine {DiffLine {'+' , []byte ("bar" )},
550
- DiffLine {'+' , []byte ("baz" )}}
551
+ DiffLine {'+' , []byte ("baz" )}}
551
552
if ! reflect .DeepEqual (out , expected ) {
552
553
t .Fatal ("Differ StructuredDump failure:" , out )
553
554
}
@@ -661,7 +662,7 @@ func TestGetUnifiedDiffString(t *testing.T) {
661
662
// Build diff
662
663
diff := UnifiedDiff {A : SplitLines (A ),
663
664
FromFile : "file" , FromDate : "then" ,
664
- B : SplitLines (B ),
665
+ B : SplitLines (B ),
665
666
ToFile : "tile" , ToDate : "now" , Eol : []byte {}, Context : 1 }
666
667
// Run test
667
668
diffStr , err := GetUnifiedDiffString (diff )
0 commit comments