Files
EdgeCommon/pkg/serverconfigs/http_access_log_ref_test.go
GoEdgeLab 2f3981704e v1.4.1
2024-07-27 13:29:26 +08:00

47 lines
1018 B
Go

package serverconfigs
import (
"testing"
"github.com/iwind/TeaGo/assert"
)
func TestHTTPAccessLogConfig_Match(t *testing.T) {
a := assert.NewAssertion(t)
{
accessLog := NewHTTPAccessLogRef()
a.IsNil(accessLog.Init())
a.IsTrue(accessLog.Match(100))
a.IsTrue(accessLog.Match(200))
a.IsTrue(accessLog.Match(300))
a.IsTrue(accessLog.Match(400))
a.IsTrue(accessLog.Match(500))
}
{
accessLog := NewHTTPAccessLogRef()
accessLog.Status1 = false
accessLog.Status2 = false
a.IsNil(accessLog.Init())
a.IsFalse(accessLog.Match(100))
a.IsFalse(accessLog.Match(200))
a.IsTrue(accessLog.Match(300))
a.IsTrue(accessLog.Match(400))
a.IsTrue(accessLog.Match(500))
}
{
accessLog := NewHTTPAccessLogRef()
accessLog.Status3 = false
accessLog.Status4 = false
accessLog.Status5 = false
a.IsNil(accessLog.Init())
a.IsTrue(accessLog.Match(100))
a.IsTrue(accessLog.Match(200))
a.IsFalse(accessLog.Match(300))
a.IsFalse(accessLog.Match(400))
a.IsFalse(accessLog.Match(500))
}
}