MCPcopy
hub / github.com/rclone/rclone / TestJoinRootPath

Function TestJoinRootPath

fs/fspath/path_test.go:605–646  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

603}
604
605func TestJoinRootPath(t *testing.T) {
606 for _, test := range []struct {
607 remote string
608 filePath string
609 want string
610 }{
611 {"", "", ""},
612 {"", "/", "/"},
613 {"/", "", "/"},
614 {"/", "/", "/"},
615 {"/", "//", "/"},
616 {"/root", "", "/root"},
617 {"/root", "/", "/root"},
618 {"/root", "//", "/root"},
619 {"/a/b", "", "/a/b"},
620 {"//", "/", "//"},
621 {"//server", "path", "//server/path"},
622 {"//server/sub", "path", "//server/sub/path"},
623 {"//server", "//path", "//server/path"},
624 {"//server/sub", "//path", "//server/sub/path"},
625 {"//", "/", "//"},
626 {"//server", "path", "//server/path"},
627 {"//server/sub", "path", "//server/sub/path"},
628 {"//server", "//path", "//server/path"},
629 {"//server/sub", "//path", "//server/sub/path"},
630 {filepath.FromSlash("//server/sub"), filepath.FromSlash("//path"), "//server/sub/path"},
631 {"s3:", "", "s3:"},
632 {"s3:", ".", "s3:"},
633 {"s3:.", ".", "s3:"},
634 {"s3:", "..", "s3:"},
635 {"s3:dir", "sub", "s3:dir/sub"},
636 {"s3:dir", "/sub", "s3:dir/sub"},
637 {"s3:dir", "./sub", "s3:dir/sub"},
638 {"s3:/dir", "/sub/", "s3:/dir/sub"},
639 {"s3:dir", "..", "s3:dir"},
640 {"s3:dir", "/..", "s3:dir"},
641 {"s3:dir", "/../", "s3:dir"},
642 } {
643 got := JoinRootPath(test.remote, test.filePath)
644 assert.Equal(t, test.want, got, test)
645 }
646}

Callers

nothing calls this directly

Calls 2

JoinRootPathFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…