mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-29 20:11:28 +00:00
19 lines
452 B
Go
19 lines
452 B
Go
|
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"))
|
||
|
}
|