24 lines
455 B
Go
24 lines
455 B
Go
package dns
|
|
|
|
import "testing"
|
|
|
|
func TestExtractUsernameSimple(t *testing.T) {
|
|
username := ExtractUsername(
|
|
"pages.local",
|
|
"papatutuwawa.pages.local",
|
|
)
|
|
if username != "papatutuwawa" {
|
|
t.Fatalf("Unexpected username: '%s'", username)
|
|
}
|
|
}
|
|
|
|
func TestExtractUsernameDot(t *testing.T) {
|
|
username := ExtractUsername(
|
|
"pages.local",
|
|
"polynom.me.pages.local",
|
|
)
|
|
if username != "polynom.me" {
|
|
t.Fatalf("Unexpected username: '%s'", username)
|
|
}
|
|
}
|