@@ -84,30 +84,44 @@ func TestParseURL(t *testing.T) {
8484 Path : "/var/run/docker.sock" ,
8585 },
8686 },
87+ {
88+ doc : "malformed URL" ,
89+ url : "malformed %%url" ,
90+ expectedError : `invalid ssh URL: invalid URL escape "%%u"` ,
91+ },
92+ {
93+ doc : "URL missing scheme" ,
94+ url : "no-scheme.example.com" ,
95+ expectedError : "invalid ssh URL: no scheme provided" ,
96+ },
8797 {
8898 doc : "invalid URL with password" ,
8999 url : "ssh://me:passw0rd@example.com" ,
90- expectedError : "plain-text password is not supported" ,
100+ expectedError : "invalid ssh URL: plain-text password is not supported" ,
91101 },
92102 {
93103 doc : "invalid URL with query parameter" ,
94- url : "ssh://example.com?bar" ,
95- expectedError : `extra query after the host : "bar"` ,
104+ url : "ssh://example.com?foo= bar&bar=baz " ,
105+ expectedError : `invalid ssh URL: query parameters are not allowed : "foo= bar&bar=baz "` ,
96106 },
97107 {
98108 doc : "invalid URL with fragment" ,
99109 url : "ssh://example.com#bar" ,
100- expectedError : `extra fragment after the host : "bar"` ,
110+ expectedError : `invalid ssh URL: fragments are not allowed : "bar"` ,
101111 },
102112 {
103113 doc : "invalid URL without hostname" ,
104114 url : "ssh://" ,
105- expectedError : "no host specified" ,
115+ expectedError : "invalid ssh URL: hostname is empty" ,
116+ },
117+ {
118+ url : "ssh:///no-hostname" ,
119+ expectedError : "invalid ssh URL: hostname is empty" ,
106120 },
107121 {
108122 doc : "invalid URL with unsupported scheme" ,
109123 url : "https://example.com" ,
110- expectedError : `expected scheme ssh, got " https" ` ,
124+ expectedError : `invalid ssh URL: incorrect scheme: https` ,
111125 },
112126 }
113127 for _ , tc := range testCases {
0 commit comments