@@ -3,23 +3,26 @@ package underscore_test
33import (
44 "testing"
55
6- u "github.com/rjNemo/underscore"
76 "github.com/stretchr/testify/assert"
7+
8+ u "github.com/rjNemo/underscore"
89)
910
10- var zero = u.Tuple [int , string ]{Left : 0 , Right : "Zero" }
11- var one = u.Tuple [int , string ]{Left : 1 , Right : "One" }
12- var two = u.Tuple [int , string ]{Left : 2 , Right : "Two" }
13- var three = u.Tuple [int , string ]{Left : 3 , Right : "Three" }
11+ var (
12+ zero = u.Tuple [int , string ]{Left : 0 , Right : "Zero" }
13+ one = u.Tuple [int , string ]{Left : 1 , Right : "One" }
14+ two = u.Tuple [int , string ]{Left : 2 , Right : "Two" }
15+ three = u.Tuple [int , string ]{Left : 3 , Right : "Three" }
16+ )
1417
1518func Test_Join_Can_Join_Two_Slices_Together (t * testing.T ) {
16- var left = []u.Tuple [int , string ]{zero , one , two , three }
17- var right = []u.Tuple [int , string ]{one , three , two , three , two , three }
19+ left : = []u.Tuple [int , string ]{zero , one , two , three }
20+ right : = []u.Tuple [int , string ]{one , three , two , three , two , three }
1821
1922 selector := func (x u.Tuple [int , string ]) int { return x .Left }
2023
21- var joined = u .Join (left , right , selector , selector )
22- var want = []u.Tuple [u.Tuple [int , string ], []u.Tuple [int , string ]]{
24+ joined : = u .Join (left , right , selector , selector )
25+ want : = []u.Tuple [u.Tuple [int , string ], []u.Tuple [int , string ]]{
2326 {Left : zero , Right : nil },
2427 {Left : one , Right : []u.Tuple [int , string ]{one }},
2528 {Left : two , Right : []u.Tuple [int , string ]{two , two }},
@@ -30,16 +33,16 @@ func Test_Join_Can_Join_Two_Slices_Together(t *testing.T) {
3033}
3134
3235func Test_Join_Can_Join_and_Project_Two_Slices_Together (t * testing.T ) {
33- var left = []u.Tuple [int , string ]{zero , one , two , three }
34- var right = []u.Tuple [int , string ]{one , three , two , three , two , three }
36+ left : = []u.Tuple [int , string ]{zero , one , two , three }
37+ right : = []u.Tuple [int , string ]{one , three , two , three , two , three }
3538
3639 selector := func (x u.Tuple [int , string ]) int { return x .Left }
3740 project := func (x u.Tuple [u.Tuple [int , string ], []u.Tuple [int , string ]]) int {
3841 return len (x .Right ) // projecting to a could of how many
3942 }
4043
41- var joined = u .JoinProject (left , right , selector , selector , project )
42- var want = []int {0 , 1 , 2 , 3 }
44+ joined : = u .JoinProject (left , right , selector , selector , project )
45+ want : = []int {0 , 1 , 2 , 3 }
4346
4447 assert .Equal (t , want , joined )
4548}
0 commit comments