mirror of
https://github.com/fumiama/terasu-cloudflared.git
synced 2026-06-05 00:50:24 +08:00
36 lines
701 B
Go
36 lines
701 B
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestCreateListenerHostAndPortSuccess(t *testing.T) {
|
|
listener, err := createListener("localhost:1234")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if listener.Addr().String() == "" {
|
|
t.Fatal("Fail to find available port")
|
|
}
|
|
}
|
|
|
|
func TestCreateListenerOnlyHostSuccess(t *testing.T) {
|
|
listener, err := createListener("localhost:")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if listener.Addr().String() == "" {
|
|
t.Fatal("Fail to find available port")
|
|
}
|
|
}
|
|
|
|
func TestCreateListenerOnlyPortSuccess(t *testing.T) {
|
|
listener, err := createListener(":8888")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if listener.Addr().String() == "" {
|
|
t.Fatal("Fail to find available port")
|
|
}
|
|
}
|