Files
EdgeCommon/pkg/serverconfigs/http_wildcard_status_test.go

33 lines
502 B
Go
Raw Normal View History

2020-09-16 20:29:26 +08:00
package serverconfigs
import (
"testing"
2024-07-27 13:29:26 +08:00
"github.com/iwind/TeaGo/assert"
2020-09-16 20:29:26 +08:00
)
func TestWildcardStatus_Match(t *testing.T) {
a := assert.NewAssertion(t)
{
s := NewWildcardStatus("123")
a.IsTrue(s.Match(123))
}
{
s := NewWildcardStatus("5x3")
a.IsTrue(s.Match(523))
a.IsTrue(s.Match(553))
}
{
s := NewWildcardStatus("5xx")
a.IsTrue(s.Match(523))
a.IsTrue(s.Match(553))
a.IsTrue(s.Match(500))
a.IsFalse(s.Match(5000))
a.IsFalse(s.Match(50))
a.IsFalse(s.Match(400))
}
}