mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 08:58:26 +08:00
fstest: add precision to CompareItems so it works on non-local remotes
This commit is contained in:
parent
9f549f848d
commit
743dabf159
|
@ -207,9 +207,10 @@ func TestMarch(t *testing.T) {
|
|||
err := mt.currentError()
|
||||
require.NoError(t, err)
|
||||
|
||||
fstest.CompareItems(t, mt.srcOnly, srcOnly, test.dirSrcOnly, "srcOnly")
|
||||
fstest.CompareItems(t, mt.dstOnly, dstOnly, test.dirDstOnly, "dstOnly")
|
||||
fstest.CompareItems(t, mt.match, match, test.dirMatch, "match")
|
||||
precision := fs.GetModifyWindow(r.Fremote, r.Flocal)
|
||||
fstest.CompareItems(t, mt.srcOnly, srcOnly, test.dirSrcOnly, precision, "srcOnly")
|
||||
fstest.CompareItems(t, mt.dstOnly, dstOnly, test.dirDstOnly, precision, "dstOnly")
|
||||
fstest.CompareItems(t, mt.match, match, test.dirMatch, precision, "match")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -273,8 +274,9 @@ func TestMarchNoTraverse(t *testing.T) {
|
|||
err := mt.currentError()
|
||||
require.NoError(t, err)
|
||||
|
||||
fstest.CompareItems(t, mt.srcOnly, srcOnly, test.dirSrcOnly, "srcOnly")
|
||||
fstest.CompareItems(t, mt.match, match, test.dirMatch, "match")
|
||||
precision := fs.GetModifyWindow(r.Fremote, r.Flocal)
|
||||
fstest.CompareItems(t, mt.srcOnly, srcOnly, test.dirSrcOnly, precision, "srcOnly")
|
||||
fstest.CompareItems(t, mt.match, match, test.dirMatch, precision, "match")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -348,10 +348,10 @@ func CheckItems(t *testing.T, f fs.Fs, items ...Item) {
|
|||
CheckListingWithPrecision(t, f, items, nil, fs.GetModifyWindow(f))
|
||||
}
|
||||
|
||||
// CompareItems compares a set of DirEntries to a slice of items and a lit of dirs
|
||||
func CompareItems(t *testing.T, entries fs.DirEntries, items []Item, expectedDirs []string, what string) {
|
||||
// CompareItems compares a set of DirEntries to a slice of items and a list of dirs
|
||||
// The modtimes are compared with the precision supplied
|
||||
func CompareItems(t *testing.T, entries fs.DirEntries, items []Item, expectedDirs []string, precision time.Duration, what string) {
|
||||
is := NewItems(items)
|
||||
precision, _ := time.ParseDuration("1s")
|
||||
var objs []fs.Object
|
||||
var dirs []fs.Directory
|
||||
wantListing1, wantListing2 := makeListingFromItems(items)
|
||||
|
|
Loading…
Reference in New Issue
Block a user