mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-01 09:24:06 +08:00
Merge pull request #1268 from mholt/fix-files-test
Sort the resulting slice before the comparison.
This commit is contained in:
commit
8acf043297
@ -9,6 +9,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
@ -766,11 +767,14 @@ func TestFiles(t *testing.T) {
|
|||||||
if numFiles == 0 && len(actual) != 0 {
|
if numFiles == 0 && len(actual) != 0 {
|
||||||
t.Errorf(testPrefix+"Expected files %v, got: %v",
|
t.Errorf(testPrefix+"Expected files %v, got: %v",
|
||||||
test.fileNames, actual)
|
test.fileNames, actual)
|
||||||
} else if numFiles > 0 && !reflect.DeepEqual(test.fileNames, actual) {
|
} else {
|
||||||
|
sort.Strings(actual)
|
||||||
|
if numFiles > 0 && !reflect.DeepEqual(test.fileNames, actual) {
|
||||||
t.Errorf(testPrefix+"Expected files %v, got: %v",
|
t.Errorf(testPrefix+"Expected files %v, got: %v",
|
||||||
test.fileNames, actual)
|
test.fileNames, actual)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if dirPath != "" {
|
if dirPath != "" {
|
||||||
if err := os.RemoveAll(dirPath); err != nil && !os.IsNotExist(err) {
|
if err := os.RemoveAll(dirPath); err != nil && !os.IsNotExist(err) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user