(t *testing.T)
| 203 | } |
| 204 | |
| 205 | func 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"}, |
nothing calls this directly
no test coverage detected
searching dependent graphs…