File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -132,6 +132,24 @@ defmodule URITest do
132
132
assert URI . parse ( "https" )
133
133
end
134
134
135
+ test :ipv6_addresses do
136
+ simple_uri = URI . parse ( "http://[2607:f3f0:2:0:216:3cff:fef0:174a]/" )
137
+ assert simple_uri . host == "2607:f3f0:2:0:216:3cff:fef0:174a"
138
+
139
+ userinfo_uri = URI . parse ( "http://user:pass@[2607:f3f0:2:0:216:3cff:fef0:174a]/" )
140
+ assert userinfo_uri . host == "2607:f3f0:2:0:216:3cff:fef0:174a"
141
+ assert userinfo_uri . userinfo == "user:pass"
142
+
143
+ port_uri = URI . parse ( "http://[2607:f3f0:2:0:216:3cff:fef0:174a]:2222/" )
144
+ assert port_uri . host == "2607:f3f0:2:0:216:3cff:fef0:174a"
145
+ assert port_uri . port == 2222
146
+
147
+ userinfo_port_uri = URI . parse ( "http://user:pass@[2607:f3f0:2:0:216:3cff:fef0:174a]:2222/" )
148
+ assert userinfo_port_uri . host == "2607:f3f0:2:0:216:3cff:fef0:174a"
149
+ assert userinfo_port_uri . userinfo == "user:pass"
150
+ assert userinfo_port_uri . port == 2222
151
+ end
152
+
135
153
test :downcase_scheme do
136
154
assert URI . parse ( "hTtP://google.com" ) . scheme == "http"
137
155
end
You can’t perform that action at this time.
0 commit comments