From 98c17bcdf21a94b562d8f8b65e4b22fd17b5db92 Mon Sep 17 00:00:00 2001 From: ericdreeves Date: Sat, 19 Nov 2016 08:37:36 -0600 Subject: [PATCH] Sort the resulting slice before the comparison. --- caddyhttp/httpserver/context_test.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/caddyhttp/httpserver/context_test.go b/caddyhttp/httpserver/context_test.go index cb568d77d..b349f424e 100644 --- a/caddyhttp/httpserver/context_test.go +++ b/caddyhttp/httpserver/context_test.go @@ -9,6 +9,7 @@ import ( "os" "path/filepath" "reflect" + "sort" "strings" "testing" "time" @@ -766,9 +767,12 @@ func TestFiles(t *testing.T) { if numFiles == 0 && len(actual) != 0 { t.Errorf(testPrefix+"Expected files %v, got: %v", test.fileNames, actual) - } else if numFiles > 0 && !reflect.DeepEqual(test.fileNames, actual) { - t.Errorf(testPrefix+"Expected files %v, got: %v", - test.fileNames, actual) + } else { + sort.Strings(actual) + if numFiles > 0 && !reflect.DeepEqual(test.fileNames, actual) { + t.Errorf(testPrefix+"Expected files %v, got: %v", + test.fileNames, actual) + } } }