MCPcopy
hub / github.com/rclone/rclone / TestPatternMatchToEntries

Function TestPatternMatchToEntries

backend/googlephotos/pattern_test.go:205–393  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

203}
204
205func TestPatternMatchToEntries(t *testing.T) {
206 ctx := context.Background()
207 f := newTestLister(t)
208 f.names = []string{"file.jpg"}
209 f.albums.add(&api.Album{
210 ID: "1",
211 Title: "sub/one",
212 })
213 f.albums.add(&api.Album{
214 ID: "2",
215 Title: "sub",
216 })
217 f.uploaded.AddEntry(mockobject.New("upload/file1.jpg"))
218 f.uploaded.AddEntry(mockobject.New("upload/dir/file2.jpg"))
219
220 for testNumber, test := range []struct {
221 // input
222 root string
223 itemPath string
224 // expected output
225 wantMatch []string
226 wantPrefix string
227 remotes []string
228 }{
229 {
230 root: "",
231 itemPath: "",
232 wantMatch: []string{""},
233 wantPrefix: "",
234 remotes: []string{"media/", "album/", "shared-album/", "upload/"},
235 },
236 {
237 root: "upload",
238 itemPath: "",
239 wantMatch: []string{"upload", ""},
240 wantPrefix: "",
241 remotes: []string{"upload/file1.jpg", "upload/dir/"},
242 },
243 {
244 root: "upload",
245 itemPath: "dir",
246 wantMatch: []string{"upload/dir", "dir"},
247 wantPrefix: "dir/",
248 remotes: []string{"upload/dir/file2.jpg"},
249 },
250 {
251 root: "media",
252 itemPath: "",
253 wantMatch: []string{"media"},
254 wantPrefix: "",
255 remotes: []string{"all/", "by-year/", "by-month/", "by-day/"},
256 },
257 {
258 root: "media/all",
259 itemPath: "",
260 wantMatch: []string{"media/all"},
261 wantPrefix: "",
262 remotes: []string{"file.jpg"},

Callers

nothing calls this directly

Calls 8

NewFunction · 0.92
newTestListerFunction · 0.85
matchMethod · 0.80
RunMethod · 0.65
RemoteMethod · 0.65
addMethod · 0.45
AddEntryMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…