Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dispatcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ func TestDispatcherInvoke(t *testing.T) {
t.Fatal("expected error, got nil")
}
badMsg := Message{Address: "/["}
if err := d.Invoke(badMsg, false); err == nil {
t.Fatal("expected error, got nil")
if err := d.Invoke(badMsg, false); err != nil {
t.Fatal("expected nil, got error")
}
if err := d.Invoke(Message{Address: "/bar"}, false); err != nil {
t.Fatal(err)
Expand Down
10 changes: 5 additions & 5 deletions message.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,19 @@ func (msg Message) Equal(other Packet) bool {
}

// Match returns true if the address of the OSC Message matches the given address.
func (msg Message) Match(address string, exactMatch bool) (bool, error) {
func (msg Message) Match(addressPattern string, exactMatch bool) (bool, error) {
if exactMatch {
return address == msg.Address, nil
return addressPattern == msg.Address, nil
}
// Verify same number of parts.
if !VerifyParts(address, msg.Address) {
if !VerifyParts(addressPattern, msg.Address) {
return false, nil
}
exp, err := GetRegex(msg.Address)
exp, err := GetRegex(addressPattern)
if err != nil {
return false, err
}
return exp.MatchString(address), nil
return exp.MatchString(msg.Address), nil
}

// Typetags returns a padded byte slice of the message's type tags.
Expand Down
8 changes: 4 additions & 4 deletions message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ func TestMatch(t *testing.T) {
{"/path/to/method*", "/path/to/method"},
{"/path/to/m[aei]thod", "/path/to/method"},
} {
msg := Message{Address: pair[0]}
match, err := msg.Match(pair[1], false)
msg := Message{Address: pair[1]}
match, err := msg.Match(pair[0], false)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -113,8 +113,8 @@ func TestMatch(t *testing.T) {
}

msg := Message{Address: `/[`}
if _, err := msg.Match(`/a`, false); err == nil {
t.Fatalf("expected error, got nil")
if _, err := msg.Match(`/a`, false); err != nil {
t.Fatalf("expected nil, got error")
}
}

Expand Down