Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 11, 23:30 UTC
refactor: use slices.Equal to simplify code (#7141)
Signed-off-by: minxinyi <minxinyi6@outlook.com>
minxinyi committed
Jul 23, 2025 at 22:07 UTC
ab3b2d64ba9bf7dadd4440a84894ebab0ee6d5ea
1 file changed
+2
-12
modules/caddyhttp/encode/encode_test.go
+2
-12
@@ -2,6 +2,7 @@ package encode
2
3
import (
4
"net/http"
5
+ "slices"
6
"sync"
7
"testing"
8
)
@@ -112,7 +113,7 @@ func TestPreferOrder(t *testing.T) {
113
}
114
enc.Prefer = test.prefer
115
result := AcceptedEncodings(r, enc.Prefer)
115
- if !sliceEqual(result, test.expected) {
116
+ if !slices.Equal(result, test.expected) {
117
t.Errorf("AcceptedEncodings() actual: %s expected: %s",
118
result,
119
test.expected)
@@ -121,17 +122,6 @@ func TestPreferOrder(t *testing.T) {
122
}
123
}
124
124
-func sliceEqual(a, b []string) bool {
125
- if len(a) != len(b) {
126
- return false
127
- }
128
- for i := range a {
129
- if a[i] != b[i] {
130
- return false
131
- }
132
- }
133
- return true
134
-}
125
126
func TestValidate(t *testing.T) {
127
type testCase struct {