Files
ss/internal/corecfg/manager_test.go
2026-07-20 14:52:39 +08:00

34 lines
637 B
Go

package corecfg
import (
"reflect"
"testing"
)
func TestDedupeMatchRule(t *testing.T) {
rules := []interface{}{
"DOMAIN,example.com,sub-a | Proxy",
"MATCH,sub-a | Auto",
"DOMAIN,other.com,sub-b | Proxy",
"MATCH,sub-b | Auto",
}
got := dedupeMatchRule(rules)
want := []interface{}{
"DOMAIN,example.com,sub-a | Proxy",
"DOMAIN,other.com,sub-b | Proxy",
"MATCH,all proxies",
}
if !reflect.DeepEqual(got, want) {
t.Fatalf("got %#v, want %#v", got, want)
}
}
func TestDedupeMatchRuleNonList(t *testing.T) {
if got := dedupeMatchRule(nil); got != nil {
t.Fatalf("expected nil passthrough, got %#v", got)
}
}