Skip to content

Commit

Permalink
Sort strings in TestSliceOrderString to avoid false positives
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-nichter committed Dec 8, 2022
1 parent a20c9ea commit f39112b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions deep_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"reflect"
"sort"
"testing"
"time"
"unsafe"
Expand Down Expand Up @@ -1549,11 +1550,12 @@ func TestSliceOrderString(t *testing.T) {
if len(diff) != 3 {
t.Fatalf("expected 2 diff, got %d: %s", len(diff), diff)
}
if diff[0] != "(unordered) slice[]=foo: value count: 1 != 0" {
t.Errorf("got %s, expected '(unordered) slice[]=foo: value count: 1 != 0", diff[0])
sort.Strings(diff)
if diff[0] != "(unordered) slice[]=bar: value count: 1 != 0" {
t.Errorf("got %s, expected '(unordered) slice[]=bar: value count: 1 != 0'", diff[0])
}
if diff[1] != "(unordered) slice[]=bar: value count: 1 != 0" {
t.Errorf("got %s, expected '(unordered) slice[]=bar: value count: 1 != 0'", diff[1])
if diff[1] != "(unordered) slice[]=foo: value count: 1 != 0" {
t.Errorf("got %s, expected '(unordered) slice[]=foo: value count: 1 != 0", diff[1])
}
if diff[2] != "(unordered) slice[]=x: value count: 0 != 1" {
t.Errorf("got %s, expected '(unordered) slice[]=x: value count: 0 != 1'", diff[2])
Expand Down

0 comments on commit f39112b

Please sign in to comment.