initial
This commit is contained in:
41
rclone/list_test.go
Executable file
41
rclone/list_test.go
Executable file
@@ -0,0 +1,41 @@
|
||||
package rclone
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"sort"
|
||||
"strconv"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestList(t *testing.T) {
|
||||
rc, def := makeRC()
|
||||
defer def()
|
||||
|
||||
d, err := ioutil.TempDir(os.TempDir(), "list.*")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for i := 0; i < 3; i++ {
|
||||
if err := ioutil.WriteFile(path.Join(d, strconv.Itoa(i)), []byte("hi"), os.ModePerm); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
names, err := rc.List("local:" + d)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if len(names) != 3 {
|
||||
t.Fatal(len(names))
|
||||
}
|
||||
|
||||
sort.Strings(names)
|
||||
for i := range names {
|
||||
if names[i] != strconv.Itoa(i) {
|
||||
t.Error(names[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user