package sborepo

import (
	"testing"
)

func TestPkgIterHelpers(t *testing.T) {
	pkgs := []*Package{
		{Name: "alpha"},
		{Name: "beta"},
		{Name: "gamma"},
	}
	iter := func(f PkgFunc) {
		for _, pkg := range pkgs {
			f(pkg)
		}
	}

	if names := Names(iter); !sortedEqual(names, []string{"alpha", "beta", "gamma"}) {
		t.Fatalf("unexpected collected names: %v", names)
	}
}
