Removed socket mutexes. Added more tests. Improved examples.
Socket mutexes are no longer really required, and so have been removed. Added more tests for network encoding functions, and the URL parser. The URL parser now returns a path preceeded with a '/' instead of cutting it out. Added get_uri() to URL, for getting the whole URI, so users don't have to concat it themselves from the more specialised functions. Fixed default socket connect timeout checking for the wrong value. Fixed request_type_strings not containing all of the possible request types. Fixed README using old socket close syntax. Cleaned up the examples a bit.
This commit is contained in:
+26
-2
@@ -10,7 +10,7 @@ TEST(URLTest, full_parse)
|
||||
fr::URL url("http://example.com:80/path/path?query=10&bob=20#frag");
|
||||
ASSERT_EQ(url.get_host(), "example.com");
|
||||
ASSERT_EQ(url.get_scheme(), fr::URL::HTTP);
|
||||
ASSERT_EQ(url.get_path(), "path/path");
|
||||
ASSERT_EQ(url.get_path(), "/path/path");
|
||||
ASSERT_EQ(url.get_query(), "query=10&bob=20");
|
||||
ASSERT_EQ(url.get_fragment(), "frag");
|
||||
}
|
||||
@@ -38,6 +38,30 @@ TEST(URLTest, fragment_test)
|
||||
TEST(URLTest, path_test)
|
||||
{
|
||||
fr::URL url("example.com/path/hey#frag");
|
||||
ASSERT_EQ(url.get_path(), "path/hey");
|
||||
ASSERT_EQ(url.get_path(), "/path/hey");
|
||||
ASSERT_EQ(url.get_fragment(), "frag");
|
||||
}
|
||||
|
||||
TEST(URLTest, uri_test)
|
||||
{
|
||||
fr::URL url("http://example.com:80/path/path?query=10#frag");
|
||||
ASSERT_EQ(url.get_uri(), "/path/path?query=10#frag");
|
||||
}
|
||||
|
||||
TEST(URLTest, uri_test2)
|
||||
{
|
||||
fr::URL url("http://example.com:80/path/path?query=10");
|
||||
ASSERT_EQ(url.get_uri(), "/path/path?query=10");
|
||||
}
|
||||
|
||||
TEST(URLTest, uri_test3)
|
||||
{
|
||||
fr::URL url("http://example.com:80/path/path#frag");
|
||||
ASSERT_EQ(url.get_uri(), "/path/path#frag");
|
||||
}
|
||||
|
||||
TEST(URLTest, uri_test4)
|
||||
{
|
||||
fr::URL url("http://example.com:80/?bob=10#frag");
|
||||
ASSERT_EQ(url.get_uri(), "/?bob=10#frag");
|
||||
}
|
||||
Reference in New Issue
Block a user