Fix domain endpoint validation

This commit is contained in:
Daniel
2020-10-13 15:54:37 +02:00
parent eab2ab3413
commit ab55f908c9
2 changed files with 81 additions and 46 deletions

View File

@@ -5,6 +5,8 @@ import (
"runtime"
"testing"
"github.com/stretchr/testify/assert"
"github.com/safing/portmaster/core/pmtesting"
"github.com/safing/portmaster/intel"
)
@@ -27,6 +29,20 @@ func testEndpointMatch(t *testing.T, ep Endpoint, entity *intel.Entity, expected
}
}
func testFormat(t *testing.T, endpoint string) {
_, err := parseEndpoint(endpoint)
assert.NoError(t, err)
}
func TestEndpointFormat(t *testing.T) {
testFormat(t, "+ .")
testFormat(t, "+ .at")
testFormat(t, "+ .at.")
testFormat(t, "+ 1.at")
testFormat(t, "+ 1.at.")
testFormat(t, "+ 1.f.ix.de.")
}
func TestEndpointMatching(t *testing.T) {
// ANY