Skip to content
Snippets Groups Projects
Commit f5631982 authored by Manuel Kieweg's avatar Manuel Kieweg
Browse files

sort slices

parent 1d745154
No related branches found
No related tags found
2 merge requests!120Resolve "Code Quality",!90Develop
...@@ -7,6 +7,7 @@ import ( ...@@ -7,6 +7,7 @@ import (
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"os" "os"
"reflect" "reflect"
"sort"
"testing" "testing"
) )
...@@ -99,6 +100,18 @@ func TestParseSchema(t *testing.T) { ...@@ -99,6 +100,18 @@ func TestParseSchema(t *testing.T) {
t.Errorf("ParseSchema() error = %v, wantErr %v", err, tt.wantErr) t.Errorf("ParseSchema() error = %v, wantErr %v", err, tt.wantErr)
return return
} }
sort.Slice(tt.want["Test_Container1"].Children, func(i, j int) bool {
return i < j
})
sort.Slice(tt.want["Test_Container2"].Children, func(i, j int) bool {
return i < j
})
sort.Slice(got["Test_Container1"].Children, func(i, j int) bool {
return i < j
})
sort.Slice(got["Test_Container2"].Children, func(i, j int) bool {
return i < j
})
if !reflect.DeepEqual(got, tt.want) { if !reflect.DeepEqual(got, tt.want) {
t.Errorf("ParseSchema() got = %v, want %v", got, tt.want) t.Errorf("ParseSchema() got = %v, want %v", got, tt.want)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment