mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-22 10:40:25 +08:00
36 lines
632 B
Go
36 lines
632 B
Go
|
|
package serverconfigs
|
||
|
|
|
||
|
|
import (
|
||
|
|
"github.com/iwind/TeaGo/logs"
|
||
|
|
"testing"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestNormalizeServerNames(t *testing.T) {
|
||
|
|
serverNames := []*ServerNameConfig{
|
||
|
|
{
|
||
|
|
Name: "Hello.com",
|
||
|
|
SubNames: []string{"WoRld.com", "XYZ.com"},
|
||
|
|
},
|
||
|
|
}
|
||
|
|
NormalizeServerNames(serverNames)
|
||
|
|
logs.PrintAsJSON(serverNames, t)
|
||
|
|
}
|
||
|
|
|
||
|
|
func TestPlainServerNames(t *testing.T) {
|
||
|
|
serverNames := []*ServerNameConfig{
|
||
|
|
{
|
||
|
|
Name: "Hello.com",
|
||
|
|
SubNames: nil,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Name: "world.com",
|
||
|
|
SubNames: nil,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
Name: "",
|
||
|
|
SubNames: []string{"WoRld.com", "XYZ.com"},
|
||
|
|
},
|
||
|
|
}
|
||
|
|
logs.PrintAsJSON(PlainServerNames(serverNames), t)
|
||
|
|
}
|