Commit 8acf0432 authored by Matt Holt's avatar Matt Holt Committed by GitHub

Merge pull request #1268 from mholt/fix-files-test

Sort the resulting slice before the comparison.
parents 8c392a02 98c17bcd
......@@ -9,6 +9,7 @@ import (
"os"
"path/filepath"
"reflect"
"sort"
"strings"
"testing"
"time"
......@@ -766,11 +767,14 @@ 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) {
} else {
sort.Strings(actual)
if numFiles > 0 && !reflect.DeepEqual(test.fileNames, actual) {
t.Errorf(testPrefix+"Expected files %v, got: %v",
test.fileNames, actual)
}
}
}
if dirPath != "" {
if err := os.RemoveAll(dirPath); err != nil && !os.IsNotExist(err) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment