filePart returns a BytesPart that references a file JSON schema blob made of the provided content parts.
(cps []*BytesPart, skip uint64)
| 55 | // filePart returns a BytesPart that references a file JSON schema |
| 56 | // blob made of the provided content parts. |
| 57 | func filePart(cps []*BytesPart, skip uint64) *BytesPart { |
| 58 | m := newBytes() |
| 59 | fileSize := int64(0) |
| 60 | cpl := []BytesPart{} |
| 61 | for _, cp := range cps { |
| 62 | fileSize += int64(cp.Size) |
| 63 | cpl = append(cpl, *cp) |
| 64 | } |
| 65 | err := m.PopulateParts(fileSize, cpl) |
| 66 | if err != nil { |
| 67 | panic(err) |
| 68 | } |
| 69 | json, err := m.JSON() |
| 70 | if err != nil { |
| 71 | panic(err) |
| 72 | } |
| 73 | tb := &test.Blob{Contents: json} |
| 74 | testFetcher.AddBlob(tb) |
| 75 | return &BytesPart{BytesRef: tb.BlobRef(), Size: uint64(fileSize) - skip, Offset: skip} |
| 76 | } |
| 77 | |
| 78 | func all(blob *test.Blob) *BytesPart { |
| 79 | return part(blob, 0, uint64(blob.Size())) |
no test coverage detected