mirror of
https://github.com/rclone/rclone.git
synced 2025-08-16 16:41:34 +02:00
Implement moveto and copyto commands for choosing a destination name on copy/move
Fixes #227 Fixes #476
This commit is contained in:
28
cmd/cmd_test.go
Normal file
28
cmd/cmd_test.go
Normal file
@ -0,0 +1,28 @@
|
||||
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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user