21 lines
698 B
Go
21 lines
698 B
Go
package testutil
|
|
|
|
import (
|
|
"slices"
|
|
"testing"
|
|
)
|
|
|
|
func TestFindPersonalIdentifiers(t *testing.T) {
|
|
text := `a{route="/x",user="Jane.Doe+tag@mail.example.org"} 1` + "\n" +
|
|
`b{id="0199b4f2-7c1e-7d3a-9f00-AABBCCDDEEFF"} 1` + "\n" +
|
|
`c{route="/api/v1/me/invitations/{invitationId}",status="404"} 1`
|
|
got := FindPersonalIdentifiers(text)
|
|
want := []string{"Jane.Doe+tag@mail.example.org", "0199b4f2-7c1e-7d3a-9f00-AABBCCDDEEFF"}
|
|
if !slices.Equal(got, want) {
|
|
t.Fatalf("FindPersonalIdentifiers() = %q, want %q", got, want)
|
|
}
|
|
if found := FindPersonalIdentifiers(`go_info{version="go1.26.9"} 1`); len(found) != 0 {
|
|
t.Fatalf("FindPersonalIdentifiers() reported %q in a clean text", found)
|
|
}
|
|
}
|