20 #include <boost/algorithm/string.hpp> 21 #include <glog/logging.h> 24 using namespace folly;
28 fbstring s(
"http://www.facebook.com/hello/world?query#fragment");
43 fbstring s(
"http://www.facebook.com:8080/hello/world?query#fragment");
58 fbstring s(
"http://127.0.0.1:8080/hello/world?query#fragment");
73 fbstring s(
"http://[::1]:8080/hello/world?query#fragment");
89 fbstring s(
"http://[2401:db00:20:7004:face:0:29:0]:8080/hello/world?query");
105 fbstring s(
"http://[2401:db00:20:7004:face:0:29:0]/hello/world?query");
121 fbstring s(
"http://user:pass@host.com/");
257 fbstring s(
"http://localhost?&key1=foo&key2=&key3&=bar&=bar=&");
260 std::map<fbstring, fbstring>
params;
261 for (
auto& param : paramsList) {
262 params[param.first] = param.second;
266 EXPECT_NE(params.end(), params.find(
"key2"));
268 EXPECT_NE(params.end(), params.find(
"key3"));
274 fbstring s(
"http://localhost?&&&&&&&&&&&&&&&");
282 fbstring s(
"http://localhost?&=invalid_key&key2&key3=foo");
285 std::map<fbstring, fbstring>
params;
286 for (
auto& param : paramsList) {
287 params[param.first] = param.second;
290 EXPECT_NE(params.end(), params.find(
"key2"));
297 fbstring s(
"http://localhost?&key1=====&&=key2&key3=");
300 std::map<fbstring, fbstring>
params;
301 for (
auto& param : paramsList) {
302 params[param.first] = param.second;
305 EXPECT_NE(params.end(), params.find(
"key3"));
311 fbstring s(
"http://localhost?key1=foo=bar&key2=foobar&");
314 std::map<fbstring, fbstring>
params;
315 for (
auto& param : paramsList) {
316 params[param.first] = param.second;
327 CHECK(
false) <<
"Control should not have reached here";
328 }
catch (
const std::invalid_argument& ex) {
337 Uri u(
"http://" + s);
338 CHECK(
false) <<
"Control should not have reached here";
339 }
catch (
const std::invalid_argument& ex) {
345 fbstring s(
"http://[::1:8080/hello/world?query#fragment");
349 CHECK(
false) <<
"Control should not have reached here";
350 }
catch (
const std::invalid_argument&) {
356 fbstring s(
"http://::1]:8080/hello/world?query#fragment");
360 CHECK(
false) <<
"Control should not have reached here";
361 }
catch (
const std::invalid_argument&) {
367 fbstring s(
"http://::1:8080/hello/world?query#fragment");
371 CHECK(
false) <<
"Control should not have reached here";
372 }
catch (
const std::invalid_argument&) {
378 fbstring s(
"http://2401:db00:20:7004:face:0:29:0/hello/world?query");
382 CHECK(
false) <<
"Control should not have reached here";
383 }
catch (
const std::invalid_argument&) {
const std::string & password() const
#define EXPECT_EQ(val1, val2)
const std::string & username() const
—— Concurrent Priority Queue Implementation ——
const std::string & host() const
constexpr Params params[]
const std::string & fragment() const
const std::string & query() const
#define EXPECT_TRUE(condition)
const std::string & path() const
std::string authority() const
#define EXPECT_NE(val1, val2)
const std::string & scheme() const
const std::vector< std::pair< std::string, std::string > > & getQueryParams()
TEST(SequencedExecutor, CPUThreadPoolExecutor)
std::string hostname() const