(t *testing.T)
| 446 | } |
| 447 | |
| 448 | func TestReadDirs(t *testing.T) { |
| 449 | oldMaxStaticSetMembers := maxStaticSetMembers |
| 450 | maxStaticSetMembers = 10 |
| 451 | defer func() { |
| 452 | maxStaticSetMembers = oldMaxStaticSetMembers |
| 453 | }() |
| 454 | |
| 455 | // small directory, no splitting needed. |
| 456 | testReadDir(t, []*test.Blob{ |
| 457 | {Contents: "AAAAAaaaaa"}, |
| 458 | {Contents: "BBBBBbbbbb"}, |
| 459 | {Contents: "CCCCCccccc"}, |
| 460 | }) |
| 461 | |
| 462 | // large (over maxStaticSetMembers) directory. splitting, but no recursion needed. |
| 463 | var members []*test.Blob |
| 464 | for i := 0; i < maxStaticSetMembers+3; i++ { |
| 465 | members = append(members, &test.Blob{Contents: fmt.Sprintf("sha1-%2d", i)}) |
| 466 | } |
| 467 | testReadDir(t, members) |
| 468 | |
| 469 | // very large (over maxStaticSetMembers^2) directory. splitting with recursion. |
| 470 | members = nil |
| 471 | for i := 0; i < maxStaticSetMembers*maxStaticSetMembers+3; i++ { |
| 472 | members = append(members, &test.Blob{Contents: fmt.Sprintf("sha1-%3d", i)}) |
| 473 | } |
| 474 | testReadDir(t, members) |
| 475 | } |
| 476 | |
| 477 | func testReadDir(t *testing.T, members []*test.Blob) { |
| 478 | fetcher := &test.Fetcher{} |
nothing calls this directly
no test coverage detected