mirror of
https://github.com/octoleo/restic.git
synced 2024-11-11 07:41:03 +00:00
28 lines
594 B
Go
28 lines
594 B
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
|
|
rtest "github.com/restic/restic/internal/test"
|
|
)
|
|
|
|
func TestDumpSplitPath(t *testing.T) {
|
|
testPaths := []struct {
|
|
path string
|
|
result []string
|
|
}{
|
|
{"", []string{""}},
|
|
{"test", []string{"test"}},
|
|
{"test/dir", []string{"test", "dir"}},
|
|
{"test/dir/sub", []string{"test", "dir", "sub"}},
|
|
{"/", []string{""}},
|
|
{"/test", []string{"test"}},
|
|
{"/test/dir", []string{"test", "dir"}},
|
|
{"/test/dir/sub", []string{"test", "dir", "sub"}},
|
|
}
|
|
for _, path := range testPaths {
|
|
parts := splitPath(path.path)
|
|
rtest.Equals(t, path.result, parts)
|
|
}
|
|
}
|