MCPcopy
hub / github.com/syncthing/syncthing / unifySubsCases

Function unifySubsCases

lib/model/folder_test.go:29–119  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27}
28
29func unifySubsCases() []unifySubsCase {
30 cases := []unifySubsCase{
31 {
32 // 0. trailing slashes are cleaned, known paths are just passed on
33 []string{"foo/", "bar//"},
34 []string{"foo", "bar"},
35 []string{"bar", "foo"}, // the output is sorted
36 },
37 {
38 // 1. "foo/bar" gets trimmed as it's covered by foo
39 []string{"foo", "bar/", "foo/bar/"},
40 []string{"foo", "bar"},
41 []string{"bar", "foo"},
42 },
43 {
44 // 2. "" gets simplified to the empty list; ie scan all
45 []string{"foo", ""},
46 []string{"foo"},
47 nil,
48 },
49 {
50 // 3. "foo/bar" is unknown, but it's kept
51 // because its parent is known
52 []string{"foo/bar"},
53 []string{"foo"},
54 []string{"foo/bar"},
55 },
56 {
57 // 4. two independent known paths, both are kept
58 // "usr/lib" is not a prefix of "usr/libexec"
59 []string{"usr/lib", "usr/libexec"},
60 []string{"usr", "usr/lib", "usr/libexec"},
61 []string{"usr/lib", "usr/libexec"},
62 },
63 {
64 // 5. "usr/lib" is a prefix of "usr/lib/exec"
65 []string{"usr/lib", "usr/lib/exec"},
66 []string{"usr", "usr/lib", "usr/libexec"},
67 []string{"usr/lib"},
68 },
69 {
70 // 6. .stignore and .stfolder are special and are passed on
71 // verbatim even though they are unknown
72 []string{config.DefaultMarkerName, ".stignore"},
73 []string{},
74 []string{config.DefaultMarkerName, ".stignore"},
75 },
76 {
77 // 7. but the presence of something else unknown forces an actual
78 // scan
79 []string{config.DefaultMarkerName, ".stignore", "foo/bar"},
80 []string{},
81 []string{config.DefaultMarkerName, ".stignore", "foo"},
82 },
83 {
84 // 8. explicit request to scan all
85 nil,
86 []string{"foo"},

Callers 2

TestUnifySubsFunction · 0.85
BenchmarkUnifySubsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected