func TestNegativeMatchNoAddressees(t *testing.T) { e_smtp := email.SMTPEmail{ Contents: []byte( `Foo: bar Bar: baz The-Thing: Other-Thing A body to the message `), } e, err := e_smtp.Parse() assert.Nil(t, err) matcher := NewToMatcher("*****@*****.**") assert.False(t, matcher.Matches(e), "should match email") }
func TestPositiveMatch(t *testing.T) { e_smtp := email.SMTPEmail{ Contents: []byte( `Foo: bar Bar: baz The-Thing: Other-Thing To: The Dude <*****@*****.**> A body to the message `), } e, err := e_smtp.Parse() assert.Nil(t, err) matcher := NewToMatcher("*****@*****.**") assert.True(t, matcher.Matches(e), "should match email") }
func TestNegativeMatchMultiple(t *testing.T) { e_smtp := email.SMTPEmail{ Contents: []byte( `Foo: bar Bar: baz The-Thing: Other-Thing To: "The Dude" <*****@*****.**>, "The Other Dude" <*****@*****.**> A body to the message `), } e, err := e_smtp.Parse() assert.Nil(t, err) matcher := NewToMatcher("*****@*****.**") assert.False(t, matcher.Matches(e), "should match email") }