summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMatt Holt <[email protected]>2016-11-19 08:47:53 -0700
committerGitHub <[email protected]>2016-11-19 08:47:53 -0700
commit8acf04329796fe207b2f39dc2d36768b4254f1a7 (patch)
tree6a7a8d6929497911ab157775167675232541c156
parent8c392a02c84ac70ba38595b26030156f844c35f6 (diff)
parent98c17bcdf21a94b562d8f8b65e4b22fd17b5db92 (diff)
downloadcaddy-8acf04329796fe207b2f39dc2d36768b4254f1a7.tar.gz
caddy-8acf04329796fe207b2f39dc2d36768b4254f1a7.zip
Merge pull request #1268 from mholt/fix-files-test
Sort the resulting slice before the comparison.
-rw-r--r--caddyhttp/httpserver/context_test.go10
1 files 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)
+ }
}
}