Ordered json output & Disallow unknown fields

This commit is contained in:
世界 committed 2022-07-03 11:28:15 +08:00
1 parent 85a695caa1
commit ef5cfd59d4
16 files changed
+243 -26

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
package domain
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestMatch(t *testing.T) {
r := require.New(t)
matcher := NewMatcher([]string{"domain.com"}, []string{"suffix.com", ".suffix.org"})
r.True(matcher.Match("domain.com"))
r.False(matcher.Match("my.domain.com"))
r.True(matcher.Match("suffix.com"))
r.True(matcher.Match("my.suffix.com"))
r.False(matcher.Match("suffix.org"))
r.True(matcher.Match("my.suffix.org"))
}