@@ -99,4 +99,45 @@ var _ = Describe("Validator suite", func() {
99 Entry("Partial Subdomain", "evilbar.foo", false),
99 Entry("Partial Subdomain", "evilbar.foo", false),
103+ Context("SplitHostPort", func() {
104+ type splitHostPortTableInput struct {
110+ DescribeTable("Should split the host and port",
111+ func(in splitHostPortTableInput) {
112+ host, port := splitHostPort(in.hostport)
113+ Expect(host).To(Equal(in.expectedHost))
114+ Expect(port).To(Equal(in.expectedPort))
116+ Entry("when no port is specified", splitHostPortTableInput{
117+ hostport: "foo.bar",
118+ expectedHost: "foo.bar",
121+ Entry("with a valid port specified", splitHostPortTableInput{
122+ hostport: "foo.bar:8080",
123+ expectedHost: "foo.bar",
124+ expectedPort: "8080",
126+ Entry("with an invalid port specified", splitHostPortTableInput{
127+ hostport: "foo.bar:808a",
128+ expectedHost: "foo.bar:808a",
131+ Entry("with a wildcard port specified", splitHostPortTableInput{
132+ hostport: "foo.bar:*",
133+ expectedHost: "foo.bar",
136+ Entry("when the host is specified with brackets", splitHostPortTableInput{
137+ hostport: "[foo.bar]",
138+ expectedHost: "foo.bar",