mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 09:54:44 +01:00
d846210978
This adds a context.Context parameter to NewFs and related calls. This is necessary as part of reading config from the context - backends need to be able to read the global config.
36 lines
659 B
Go
36 lines
659 B
Go
package tree
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/a8m/tree"
|
|
_ "github.com/rclone/rclone/backend/local"
|
|
"github.com/rclone/rclone/fs"
|
|
"github.com/rclone/rclone/fstest"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestTree(t *testing.T) {
|
|
fstest.Initialise()
|
|
|
|
buf := new(bytes.Buffer)
|
|
|
|
f, err := fs.NewFs(context.Background(), "testfiles")
|
|
require.NoError(t, err)
|
|
err = Tree(f, buf, new(tree.Options))
|
|
require.NoError(t, err)
|
|
assert.Equal(t, `/
|
|
├── file1
|
|
├── file2
|
|
├── file3
|
|
└── subdir
|
|
├── file4
|
|
└── file5
|
|
|
|
1 directories, 5 files
|
|
`, buf.String())
|
|
}
|