MCPcopy
hub / github.com/restic/restic / TestParseFallback

Function TestParseFallback

internal/backend/location/location_test.go:35–59  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

33}
34
35func TestParseFallback(t *testing.T) {
36 fallbackTests := []string{
37 "dir1/dir2",
38 "/dir1/dir2",
39 "/dir1:foobar/dir2",
40 `\dir1\foobar\dir2`,
41 `c:\dir1\foobar\dir2`,
42 `C:\Users\appveyor\AppData\Local\Temp\1\restic-test-879453535\repo`,
43 `c:/dir1/foobar/dir2`,
44 }
45
46 registry := location.NewRegistry()
47 registry.Register(testFactory())
48
49 for _, path := range fallbackTests {
50 t.Run(path, func(t *testing.T) {
51 u, err := location.Parse(registry, path)
52 if err != nil {
53 t.Fatalf("unexpected error: %v", err)
54 }
55 test.Equals(t, "local", u.Scheme)
56 test.Equals(t, "local:"+path, u.Config.(*testConfig).loc)
57 })
58 }
59}
60
61func TestInvalidScheme(t *testing.T) {
62 registry := location.NewRegistry()

Callers

nothing calls this directly

Calls 7

RegisterMethod · 0.95
NewRegistryFunction · 0.92
ParseFunction · 0.92
EqualsFunction · 0.92
testFactoryFunction · 0.85
RunMethod · 0.80
FatalfMethod · 0.80

Tested by

no test coverage detected