mirror of
https://github.com/rclone/rclone
synced 2024-11-13 12:09:47 +01:00
c265f451f2
Fixes #227 Fixes #476
29 lines
611 B
Go
29 lines
611 B
Go
package cmd
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestRemoteSplit(t *testing.T) {
|
|
|
|
for _, test := range []struct {
|
|
remote, wantParent, wantLeaf string
|
|
}{
|
|
{"", "", ""},
|
|
{"remote:", "", ""},
|
|
{"remote:potato", "remote:", "potato"},
|
|
{"remote:potato/sausage", "remote:potato", "sausage"},
|
|
{"/", "", ""},
|
|
{"/root", "/", "root"},
|
|
{"/a/b", "/a", "b"},
|
|
{"root", ".", "root"},
|
|
{"a/b", "a", "b"},
|
|
} {
|
|
gotParent, gotLeaf := RemoteSplit(test.remote)
|
|
assert.Equal(t, test.wantParent, gotParent, test.remote)
|
|
assert.Equal(t, test.wantLeaf, gotLeaf, test.remote)
|
|
}
|
|
}
|