Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use slices.Equal available in Go 1.21 #67

Merged
merged 1 commit into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion jsontext/decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"net"
"path"
"reflect"
"slices"
"strings"
"testing"
"testing/iotest"
Expand Down Expand Up @@ -65,7 +66,7 @@ func testDecoder(t *testing.T, where jsontest.CasePos, typeName string, td coder
if !equalTokens(tokens, td.tokens) {
t.Fatalf("%s: tokens mismatch:\ngot %v\nwant %v", where, tokens, td.tokens)
}
if !reflect.DeepEqual(pointers, td.pointers) {
if !slices.Equal(pointers, td.pointers) {
t.Fatalf("%s: pointers mismatch:\ngot %q\nwant %q", where, pointers, td.pointers)
}
case "Value":
Expand Down
3 changes: 2 additions & 1 deletion jsontext/encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"io"
"path"
"reflect"
"slices"
"testing"

"github.com/go-json-experiment/json/internal/jsonflags"
Expand Down Expand Up @@ -57,7 +58,7 @@ func testEncoder(t *testing.T, where jsontest.CasePos, formatName, typeName stri
pointers = append(pointers, enc.StackPointer())
}
}
if !reflect.DeepEqual(pointers, td.pointers) {
if !slices.Equal(pointers, td.pointers) {
t.Fatalf("%s: pointers mismatch:\ngot %q\nwant %q", where, pointers, td.pointers)
}
case "Value":
Expand Down
4 changes: 2 additions & 2 deletions jsontext/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func TestStateMachine(t *testing.T) {
got = append(got, e.Length())
}
want := []int64(op)
if !reflect.DeepEqual(got, want) {
if !slices.Equal(got, want) {
t.Fatalf("%s: stack lengths mismatch:\ngot %v\nwant %v", sequence, got, want)
}
case appendToken:
Expand Down Expand Up @@ -336,7 +336,7 @@ func TestObjectNamespace(t *testing.T) {
for i := range ns.length() {
gotNames = append(gotNames, string(ns.getUnquoted(i)))
}
if !reflect.DeepEqual(gotNames, wantNames) {
if !slices.Equal(gotNames, wantNames) {
t.Fatalf("%d: objectNamespace = {%v}, want {%v}", i, strings.Join(gotNames, " "), strings.Join(wantNames, " "))
}
}
Expand Down
Loading