simplified string sorting by using a more suitable function
This commit is contained in:
parent
3ca424050f
commit
16eeed2ad5
4 changed files with 10 additions and 10 deletions
|
@ -116,8 +116,8 @@ func TestDefaultLayout(t *testing.T) {
|
||||||
want = append(want, filepath.Join(tempdir, "data", fmt.Sprintf("%02x", i)))
|
want = append(want, filepath.Join(tempdir, "data", fmt.Sprintf("%02x", i)))
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Sort(sort.StringSlice(want))
|
sort.Strings(want)
|
||||||
sort.Sort(sort.StringSlice(dirs))
|
sort.Strings(dirs)
|
||||||
|
|
||||||
if !reflect.DeepEqual(dirs, want) {
|
if !reflect.DeepEqual(dirs, want) {
|
||||||
t.Fatalf("wrong paths returned, want:\n %v\ngot:\n %v", want, dirs)
|
t.Fatalf("wrong paths returned, want:\n %v\ngot:\n %v", want, dirs)
|
||||||
|
@ -189,8 +189,8 @@ func TestRESTLayout(t *testing.T) {
|
||||||
filepath.Join(path, "keys"),
|
filepath.Join(path, "keys"),
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Sort(sort.StringSlice(want))
|
sort.Strings(want)
|
||||||
sort.Sort(sort.StringSlice(dirs))
|
sort.Strings(dirs)
|
||||||
|
|
||||||
if !reflect.DeepEqual(dirs, want) {
|
if !reflect.DeepEqual(dirs, want) {
|
||||||
t.Fatalf("wrong paths returned, want:\n %v\ngot:\n %v", want, dirs)
|
t.Fatalf("wrong paths returned, want:\n %v\ngot:\n %v", want, dirs)
|
||||||
|
@ -335,8 +335,8 @@ func TestS3LegacyLayout(t *testing.T) {
|
||||||
filepath.Join(path, "key"),
|
filepath.Join(path, "key"),
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Sort(sort.StringSlice(want))
|
sort.Strings(want)
|
||||||
sort.Sort(sort.StringSlice(dirs))
|
sort.Strings(dirs)
|
||||||
|
|
||||||
if !reflect.DeepEqual(dirs, want) {
|
if !reflect.DeepEqual(dirs, want) {
|
||||||
t.Fatalf("wrong paths returned, want:\n %v\ngot:\n %v", want, dirs)
|
t.Fatalf("wrong paths returned, want:\n %v\ngot:\n %v", want, dirs)
|
||||||
|
|
|
@ -72,8 +72,8 @@ func verifyDirectoryContents(t testing.TB, fs FS, dir string, want []string) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Sort(sort.StringSlice(want))
|
sort.Strings(want)
|
||||||
sort.Sort(sort.StringSlice(entries))
|
sort.Strings(entries)
|
||||||
|
|
||||||
if !cmp.Equal(want, entries) {
|
if !cmp.Equal(want, entries) {
|
||||||
t.Error(cmp.Diff(want, entries))
|
t.Error(cmp.Diff(want, entries))
|
||||||
|
|
|
@ -176,7 +176,7 @@ func (b *Backup) update(total, processed counter, errors uint, currentFiles map[
|
||||||
for filename := range currentFiles {
|
for filename := range currentFiles {
|
||||||
lines = append(lines, filename)
|
lines = append(lines, filename)
|
||||||
}
|
}
|
||||||
sort.Sort(sort.StringSlice(lines))
|
sort.Strings(lines)
|
||||||
lines = append([]string{status}, lines...)
|
lines = append([]string{status}, lines...)
|
||||||
|
|
||||||
b.term.SetStatus(lines)
|
b.term.SetStatus(lines)
|
||||||
|
|
|
@ -159,7 +159,7 @@ func (b *Backup) update(total, processed counter, errors uint, currentFiles map[
|
||||||
for filename := range currentFiles {
|
for filename := range currentFiles {
|
||||||
status.CurrentFiles = append(status.CurrentFiles, filename)
|
status.CurrentFiles = append(status.CurrentFiles, filename)
|
||||||
}
|
}
|
||||||
sort.Sort(sort.StringSlice(status.CurrentFiles))
|
sort.Strings(status.CurrentFiles)
|
||||||
|
|
||||||
json.NewEncoder(b.StdioWrapper.Stdout()).Encode(status)
|
json.NewEncoder(b.StdioWrapper.Stdout()).Encode(status)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue