feat update

This commit is contained in:
tqcq 2024-03-29 09:32:18 +08:00
parent ffdbf161b4
commit a74d48b915
4 changed files with 18 additions and 2 deletions

View File

@ -26,6 +26,9 @@ public:
// http://xxx.com/index.html // http://xxx.com/index.html
static URI ParseURIReference(const std::string &uri_str); static URI ParseURIReference(const std::string &uri_str);
URI() = default;
URI(const std::string &uri_str);
// setter getter // setter getter
__SLED_URI_GETTER_AND_SETTER(std::string, scheme) __SLED_URI_GETTER_AND_SETTER(std::string, scheme)
__SLED_URI_GETTER_AND_SETTER(std::string, username) __SLED_URI_GETTER_AND_SETTER(std::string, username)

View File

@ -1,4 +1,5 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <sled/futures/promise.h>
TEST(Promise, Basic) TEST(Promise, Basic)
{ {

View File

@ -13,4 +13,6 @@ URI::ParseURI(const std::string &uri_str)
return std::move(uri); return std::move(uri);
} }
URI::URI(const std::string &uri_str) { *this = ParseURI(uri_str); }
}// namespace sled }// namespace sled

View File

@ -1,2 +1,12 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <sled/uri.h> #include <sled/uri.h>
TEST(URI, Absolute)
{
sled::URI uri("http://example.com");
EXPECT_EQ(uri.scheme(), "http");
EXPECT_EQ(uri.host(), "example.com");
EXPECT_EQ(uri.path(), "/");
EXPECT_TRUE(uri.query().empty());
EXPECT_EQ(uri.anchor(), "");
}