diff --git a/group/all/all_test.go b/group/all/all_test.go new file mode 100644 index 0000000..5c9366d --- /dev/null +++ b/group/all/all_test.go @@ -0,0 +1,34 @@ +package all_test + +import ( + "testing" + + "github.com/go-sprout/sprout/group/all" + "github.com/go-sprout/sprout/pesticide" +) + +func TestRegistryGroup(t *testing.T) { + tc := pesticide.GroupTestCase{ + RegistriesUIDs: []string{ + "go-sprout/sprout.checksum", + "go-sprout/sprout.conversion", + "go-sprout/sprout.encoding", + "go-sprout/sprout.env", + "go-sprout/sprout.filesystem", + "go-sprout/sprout.maps", + "go-sprout/sprout.network", + "go-sprout/sprout.numeric", + "go-sprout/sprout.random", + "go-sprout/sprout.reflect", + "go-sprout/sprout.regexp", + "go-sprout/sprout.semver", + "go-sprout/sprout.slices", + "go-sprout/sprout.std", + "go-sprout/sprout.strings", + "go-sprout/sprout.time", + "go-sprout/sprout.uniqueid", + }, + } + + pesticide.RunGroupTest(t, all.RegistryGroup(), tc) +} diff --git a/group/hermetic/hermetic_test.go b/group/hermetic/hermetic_test.go new file mode 100644 index 0000000..e554a67 --- /dev/null +++ b/group/hermetic/hermetic_test.go @@ -0,0 +1,31 @@ +package hermetic_test + +import ( + "testing" + + "github.com/go-sprout/sprout/group/hermetic" + "github.com/go-sprout/sprout/pesticide" +) + +func TestRegistryGroup(t *testing.T) { + tc := pesticide.GroupTestCase{ + RegistriesUIDs: []string{ + "go-sprout/sprout.checksum", + "go-sprout/sprout.conversion", + "go-sprout/sprout.encoding", + "go-sprout/sprout.filesystem", + "go-sprout/sprout.maps", + "go-sprout/sprout.numeric", + "go-sprout/sprout.reflect", + "go-sprout/sprout.regexp", + "go-sprout/sprout.semver", + "go-sprout/sprout.slices", + "go-sprout/sprout.std", + "go-sprout/sprout.strings", + "go-sprout/sprout.time", + "go-sprout/sprout.uniqueid", + }, + } + + pesticide.RunGroupTest(t, hermetic.RegistryGroup(), tc) +} diff --git a/pesticide/group_test_helpers.go b/pesticide/group_test_helpers.go new file mode 100644 index 0000000..bc35a83 --- /dev/null +++ b/pesticide/group_test_helpers.go @@ -0,0 +1,26 @@ +package pesticide + +import ( + "testing" + + "github.com/go-sprout/sprout" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +type GroupTestCase struct { + RegistriesUIDs []string +} + +func RunGroupTest(t *testing.T, rg *sprout.RegistryGroup, tc GroupTestCase) { + t.Helper() + + require.NotNil(t, rg, "RegistryGroup should not be nil") + require.NotNil(t, rg.Registries, "RegistryGroup.Registries should not be nil") + + require.Len(t, rg.Registries, len(tc.RegistriesUIDs), "The number of registries should match the number of expected registries") + + for _, registry := range rg.Registries { + assert.Contains(t, tc.RegistriesUIDs, registry.UID(), "Registry UID %s aren't excepted", registry.UID()) + } +} diff --git a/pesticide/test_helpers.go b/pesticide/template_test_helpers.go similarity index 100% rename from pesticide/test_helpers.go rename to pesticide/template_test_helpers.go