Skip to content
quarry Artifact [c123e0cc28]
Login

Artifact [c123e0cc28]

Artifact c123e0cc28bacad0ffa5e3f90f1fa34c76bb8e9cb5e63c8a1fd05c0b7aba05b0:


package index

import "testing"

// The start of a watermark walk over a repository that had nothing when
// the walk began: the earliest check-ins, oldest first.
func TestOldestCheckinsStartsAtTheBeginning(t *testing.T) {
	ix := openIndex(t)
	if got, err := ix.OldestCheckins(10); err != nil || len(got) != 0 {
		t.Fatalf("FAIL: empty repository = %v, %v", got, err)
	}
	ci(t, ix, "c2", "trunk", "2026-01-02T00:00:00", "second", "c1")
	ci(t, ix, "c1", "trunk", "2026-01-01T00:00:00", "first")
	ci(t, ix, "c3", "side", "2026-01-03T00:00:00", "third", "c2")
	got, err := ix.OldestCheckins(2)
	if err != nil {
		t.Fatal(err)
	}
	if len(got) != 2 || got[0].Hash != "c1" || got[1].Hash != "c2" {
		t.Fatalf("FAIL: OldestCheckins(2) = %v", got)
	}
	if got[0].Branch != "trunk" || got[0].Comment != "first" {
		t.Errorf("FAIL: row not filled: %+v", got[0])
	}
}