Skip to content
quarry Artifact [cb9729d923]
Login

Artifact [cb9729d923]

Artifact cb9729d92317ae36e3e9832fd8c43935ee638faf415b83cebd525ceb8d11afb3:


package index

import "testing"

// people.list asks for every contributor by passing zero, and a zero
// that means "a hundred" turned fossil's 151 people into a listing that
// said "of 100" underneath an About panel that said 151.
func TestContributorsZeroMeansAll(t *testing.T) {
	ix := openIndex(t)
	const n = 130
	for i := range n {
		user := "user" + itoa(i)
		if _, err := ix.db.Exec(`INSERT INTO contributor (user, events, first, last)
			VALUES (?, ?, '2026-01-01T00:00:00', '2026-01-02T00:00:00')`, user, n-i); err != nil {
			t.Fatal(err)
		}
	}
	all, err := ix.Contributors(0)
	if err != nil {
		t.Fatal(err)
	}
	if len(all) != n {
		t.Errorf("Contributors(0) = %d, want all %d", len(all), n)
	}
	some, err := ix.Contributors(20)
	if err != nil {
		t.Fatal(err)
	}
	if len(some) != 20 {
		t.Errorf("Contributors(20) = %d, want 20", len(some))
	}
}