File: cmd_test.go

package info (click to toggle)
rclone 1.35-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 15,900 kB
  • ctags: 3,226
  • sloc: python: 108; makefile: 107; sh: 80; xml: 29
file content (28 lines) | stat: -rw-r--r-- 611 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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)
	}
}