From 1e6eab5c334503d95a1d45b143736ae6b1ce5dec Mon Sep 17 00:00:00 2001 From: minxinyi Date: Thu, 24 Jul 2025 05:25:39 +0800 Subject: [PATCH] server: use slices.Equal to simplify code (#11502) --- server/routes_test.go | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/server/routes_test.go b/server/routes_test.go index 7c44bc9571..87b5266337 100644 --- a/server/routes_test.go +++ b/server/routes_test.go @@ -16,6 +16,7 @@ import ( "os" "path/filepath" "reflect" + "slices" "sort" "strings" "testing" @@ -82,19 +83,6 @@ func createTestFile(t *testing.T, name string) (string, string) { return f.Name(), digest } -// equalStringSlices checks if two slices of strings are equal. -func equalStringSlices(a, b []string) bool { - if len(a) != len(b) { - return false - } - for i := range a { - if a[i] != b[i] { - return false - } - } - return true -} - type panicTransport struct{} func (t *panicTransport) RoundTrip(r *http.Request) (*http.Response, error) { @@ -447,7 +435,7 @@ func TestRoutes(t *testing.T) { "stop \"foo\"", "top_p 0.9", } - if !equalStringSlices(params, expectedParams) { + if !slices.Equal(params, expectedParams) { t.Errorf("expected parameters %v, got %v", expectedParams, params) } paramCount, ok := showResp.ModelInfo["general.parameter_count"].(float64)