22 lines
465 B
Go
22 lines
465 B
Go
package mask
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestEmailsMasksEachEmail(t *testing.T) {
|
|
got := Emails([]string{"alice@example.com", "bo@example.org", "invalid"})
|
|
want := []string{"a***e@example.com", "b***@example.org", "invalid"}
|
|
|
|
if !reflect.DeepEqual(got, want) {
|
|
t.Fatalf("Emails() = %#v, want %#v", got, want)
|
|
}
|
|
}
|
|
|
|
func TestEmailsPreservesNil(t *testing.T) {
|
|
if got := Emails(nil); got != nil {
|
|
t.Fatalf("Emails(nil) = %#v, want nil", got)
|
|
}
|
|
}
|