+ {
+ fbstring s("http://[2401:db00:20:7004:face:0:29:0]:8080/hello/world?query");
+ Uri u(s);
+ EXPECT_EQ("http", u.scheme());
+ EXPECT_EQ("", u.username());
+ EXPECT_EQ("", u.password());
+ EXPECT_EQ("[2401:db00:20:7004:face:0:29:0]", u.host());
+ EXPECT_EQ("2401:db00:20:7004:face:0:29:0", u.hostname());
+ EXPECT_EQ(8080, u.port());
+ EXPECT_EQ("[2401:db00:20:7004:face:0:29:0]:8080", u.authority());
+ EXPECT_EQ("/hello/world", u.path());
+ EXPECT_EQ("query", u.query());
+ EXPECT_EQ("", u.fragment());
+ EXPECT_EQ(s, u.fbstr()); // canonical
+ }
+
+ {
+ fbstring s("http://[2401:db00:20:7004:face:0:29:0]/hello/world?query");
+ Uri u(s);
+ EXPECT_EQ("http", u.scheme());
+ EXPECT_EQ("", u.username());
+ EXPECT_EQ("", u.password());
+ EXPECT_EQ("[2401:db00:20:7004:face:0:29:0]", u.host());
+ EXPECT_EQ("2401:db00:20:7004:face:0:29:0", u.hostname());
+ EXPECT_EQ(0, u.port());
+ EXPECT_EQ("[2401:db00:20:7004:face:0:29:0]", u.authority());
+ EXPECT_EQ("/hello/world", u.path());
+ EXPECT_EQ("query", u.query());
+ EXPECT_EQ("", u.fragment());
+ EXPECT_EQ(s, u.fbstr()); // canonical
+ }
+