Skip to content

Commit

Permalink
feat: export event regex utility
Browse files Browse the repository at this point in the history
  • Loading branch information
denopink committed Mar 12, 2024
1 parent 0e0adb4 commit a9158e7
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)

Check warning on line 167 in messages.go

View check run for this annotation

Codecov / codecov/patch

messages.go#L167

Added line #L167 was not covered by tests
}

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)

Check warning on line 258 in messages.go

View check run for this annotation

Codecov / codecov/patch

messages.go#L258

Added line #L258 was not covered by tests
}

// 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 a9158e7

Please sign in to comment.