From 513a561cfd69a04c4578f2aeff8aacf72e6614fb Mon Sep 17 00:00:00 2001 From: Naser Mirzaei Date: Thu, 31 May 2018 04:14:14 +0430 Subject: [PATCH] use append instead of for loop (#37) --- id_test.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/id_test.go b/id_test.go index 204d11b..29d01a0 100644 --- a/id_test.go +++ b/id_test.go @@ -371,9 +371,7 @@ func TestSorter_Less(t *testing.T) { func TestSorter_Swap(t *testing.T) { ids := make([]ID, 0) - for _, id := range IDList { - ids = append(ids, id) - } + ids = append(ids, IDList...) sorter := sorter(ids) sorter.Swap(0, 1) if got, want := ids[0], IDList[1]; !reflect.DeepEqual(got, want) { @@ -390,9 +388,7 @@ func TestSorter_Swap(t *testing.T) { func TestSort(t *testing.T) { ids := make([]ID, 0) - for _, id := range IDList { - ids = append(ids, id) - } + ids = append(ids, IDList...) Sort(ids) if got, want := ids, []ID{IDList[1], IDList[2], IDList[0]}; !reflect.DeepEqual(got, want) { t.Fail()