mirror of
https://github.com/rclone/rclone.git
synced 2026-01-06 18:43:50 +00:00
walk: Implement walk.ListR which will use ListR if at all possible
It otherwise has the nearly the same interface as walk.Walk which it will fall back to if it can't use ListR. Using walk.ListR will speed up file system operations by default and use much less memory and start immediately compared to if --fast-list had been supplied.
This commit is contained in:
@@ -782,6 +782,39 @@ func Run(t *testing.T, opt *Opt) {
|
||||
TestFsListDirFile2(t)
|
||||
})
|
||||
|
||||
// Test the files are all there with walk.ListR recursive listings
|
||||
t.Run("FsListR", func(t *testing.T) {
|
||||
skipIfNotOk(t)
|
||||
objs, dirs, err := walk.GetAll(remote, "", true, -1)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, []string{
|
||||
"hello_ sausage",
|
||||
"hello_ sausage/êé",
|
||||
"hello_ sausage/êé/Hello, 世界",
|
||||
"hello_ sausage/êé/Hello, 世界/ _ ' @ _ _ & _ + ≠",
|
||||
}, dirsToNames(dirs))
|
||||
assert.Equal(t, []string{
|
||||
"file name.txt",
|
||||
"hello_ sausage/êé/Hello, 世界/ _ ' @ _ _ & _ + ≠/z.txt",
|
||||
}, objsToNames(objs))
|
||||
})
|
||||
|
||||
// Test the files are all there with
|
||||
// walk.ListR recursive listings on a sub dir
|
||||
t.Run("FsListRSubdir", func(t *testing.T) {
|
||||
skipIfNotOk(t)
|
||||
objs, dirs, err := walk.GetAll(remote, path.Dir(path.Dir(path.Dir(path.Dir(file2.Path)))), true, -1)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, []string{
|
||||
"hello_ sausage/êé",
|
||||
"hello_ sausage/êé/Hello, 世界",
|
||||
"hello_ sausage/êé/Hello, 世界/ _ ' @ _ _ & _ + ≠",
|
||||
}, dirsToNames(dirs))
|
||||
assert.Equal(t, []string{
|
||||
"hello_ sausage/êé/Hello, 世界/ _ ' @ _ _ & _ + ≠/z.txt",
|
||||
}, objsToNames(objs))
|
||||
})
|
||||
|
||||
// TestFsListDirRoot tests that DirList works in the root
|
||||
TestFsListDirRoot := func(t *testing.T) {
|
||||
skipIfNotOk(t)
|
||||
|
||||
Reference in New Issue
Block a user