Skip to content

Commit

Permalink
Merge pull request #162 from xmidt-org/denopink/feat/export-event-reg…
Browse files Browse the repository at this point in the history
…ex-utility

feat: export event regex utility
  • Loading branch information
denopink authored Mar 12, 2024
2 parents 0e0adb4 + a9158e7 commit ac04be7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ type Message struct {
}

func (msg *Message) FindEventStringSubMatch() string {
return findEventStringSubMatch(msg.Destination)
return FindEventStringSubMatch(msg.Destination)
}

func (msg *Message) MessageType() MessageType {
Expand Down Expand Up @@ -255,7 +255,7 @@ type SimpleRequestResponse struct {
}

func (msg *SimpleRequestResponse) FindEventStringSubMatch() string {
return findEventStringSubMatch(msg.Destination)
return FindEventStringSubMatch(msg.Destination)
}

// SetStatus simplifies setting the optional Status field, which is a pointer type tagged with omitempty.
Expand Down Expand Up @@ -489,7 +489,7 @@ func (msg *Unknown) BeforeEncode() error {
return nil
}

func findEventStringSubMatch(s string) string {
func FindEventStringSubMatch(s string) string {
var match = eventPattern.FindStringSubmatch(s)

event := "unknown"
Expand Down
2 changes: 1 addition & 1 deletion messages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestFindStringSubMatch(t *testing.T) {

var result string
for i := 0; i < len(events); i++ {
result = findEventStringSubMatch(events[i])
result = FindEventStringSubMatch(events[i])
if result != expected[i] {
t.Errorf("\ntesting %v:\ninput: %v\nexpected: %v\ngot: %v\n\n", i, spew.Sprintf(events[i]), spew.Sprintf(expected[i]), spew.Sprintf(result))
}
Expand Down

0 comments on commit ac04be7

Please sign in to comment.