Exemple #1
0
func TestIndexUnserializeOld(t *testing.T) {
	idx, err := repository.DecodeOldIndex(bytes.NewReader(docOldExample))
	OK(t, err)

	for _, test := range exampleTests {
		blob, err := idx.Lookup(test.id)
		OK(t, err)

		Equals(t, test.packID, blob.PackID)
		Equals(t, test.tpe, blob.Type)
		Equals(t, test.offset, blob.Offset)
		Equals(t, test.length, blob.Length)
	}

	Equals(t, 0, len(idx.Supersedes()))
}
Exemple #2
0
func TestIndexUnserializeOld(t *testing.T) {
	idx, err := repository.DecodeOldIndex(bytes.NewReader(docOldExample))
	OK(t, err)

	for _, test := range exampleTests {
		list, err := idx.Lookup(test.id, test.tpe)
		OK(t, err)

		if len(list) != 1 {
			t.Errorf("expected one result for blob %v, got %v: %v", test.id.Str(), len(list), list)
		}
		blob := list[0]

		Equals(t, test.packID, blob.PackID)
		Equals(t, test.tpe, blob.Type)
		Equals(t, test.offset, blob.Offset)
		Equals(t, test.length, blob.Length)
	}

	Equals(t, 0, len(idx.Supersedes()))
}