From 3346af53f7255b5542e14a4d4aa72a76b452493b Mon Sep 17 00:00:00 2001 From: James Harris Date: Thu, 3 Oct 2024 07:19:55 +1000 Subject: [PATCH] Remove `messages.NamesOf()` and `TypesOf()`. --- message/set.go | 28 ---------------------------- message/set_test.go | 27 --------------------------- 2 files changed, 55 deletions(-) delete mode 100644 message/set.go delete mode 100644 message/set_test.go diff --git a/message/set.go b/message/set.go deleted file mode 100644 index 3c2326e..0000000 --- a/message/set.go +++ /dev/null @@ -1,28 +0,0 @@ -package message - -import ( - "github.com/dogmatiq/dogma" - "github.com/dogmatiq/enginekit/collections/sets" -) - -// NamesOf returns a name set containing the names of the given messages. -func NamesOf(messages ...dogma.Message) *sets.Set[Name] { - names := &sets.Set[Name]{} - - for _, m := range messages { - names.Add(NameOf(m)) - } - - return names -} - -// TypesOf returns a type set containing the types of the given messages. -func TypesOf(messages ...dogma.Message) *sets.Set[Type] { - types := &sets.Set[Type]{} - - for _, m := range messages { - types.Add(TypeOf(m)) - } - - return types -} diff --git a/message/set_test.go b/message/set_test.go deleted file mode 100644 index 76967be..0000000 --- a/message/set_test.go +++ /dev/null @@ -1,27 +0,0 @@ -package message_test - -import ( - "testing" - - . "github.com/dogmatiq/configkit/message" - "github.com/dogmatiq/enginekit/collections/sets" - . "github.com/dogmatiq/enginekit/enginetest/stubs" -) - -func TestNamesOf(t *testing.T) { - got := NamesOf(CommandA1, EventA1) - want := sets.New(NameOf(CommandA1), NameOf(EventA1)) - - if !got.IsEqual(want) { - t.Fatalf("unexpected result: got %v, want %v", got, want) - } -} - -func TestTypesOf(t *testing.T) { - got := TypesOf(CommandA1, EventA1) - want := sets.New(TypeOf(CommandA1), TypeOf(EventA1)) - - if !got.IsEqual(want) { - t.Fatalf("unexpected result: got %v, want %v", got, want) - } -}