Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8cfecda

Browse files
committed
[URI] Added first relative URI test.
1 parentaba7b0e commit8cfecda

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

‎boost/network/uri/uri.hpp‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include<boost/network/uri/detail/uri_parts.hpp>
1111
#include<boost/operators.hpp>
1212
#include<boost/utility/swap.hpp>
13+
#include<boost/range/algorithm/equal.hpp>
1314
#include<boost/range/iterator_range.hpp>
1415
#include<boost/lexical_cast.hpp>
1516
#include<boost/optional.hpp>
@@ -272,6 +273,11 @@ bool valid(const uri &uri_) {
272273
return uri_.is_valid();
273274
}
274275

276+
inline
277+
boolis_absolute(const uri &uri_) {
278+
return uri_.is_valid() && !boost::empty(uri_.scheme_range());
279+
}
280+
275281
inline
276282
boolis_valid(const uri &uri_) {
277283
returnvalid(uri_);

‎libs/network/src/uri/parse.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ struct uri_grammar : qi::grammar<
188188
;
189189

190190
start %=
191-
scheme >>':'
191+
-(scheme >>':')
192192
>> hier_part
193193
>> -('?' >> query)
194194
>> -('#' >> fragment)

‎libs/network/test/uri/CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ if (Boost_FOUND)
1111
url_test
1212
url_builder_test
1313
url_encoding_test
14+
relative_url_test
1415
)
1516
foreach (test${TESTS})
1617
if (${CMAKE_CXX_COMPILER_ID}MATCHES GNU)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2009, 2010, 2011 Dean Michael Berris, Jeroen Habraken, Glyn Matthews.
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// (See accompanying file LICENSE_1_0.txt of copy at
4+
// http://www.boost.org/LICENSE_1_0.txt)
5+
6+
#defineBOOST_TEST_MODULE URL Test
7+
#include<boost/config/warning_disable.hpp>
8+
#include<boost/test/unit_test.hpp>
9+
#include<boost/network/uri/uri.hpp>
10+
#include<boost/network/uri/uri_io.hpp>
11+
12+
13+
usingnamespaceboost::network;
14+
15+
BOOST_AUTO_TEST_CASE(relative_uri_test) {
16+
uri::uriinstance("www.example.com/");
17+
BOOST_REQUIRE(uri::valid(instance));
18+
BOOST_CHECK(uri::is_absolute(instance));
19+
BOOST_CHECK_EQUAL(uri::path(instance),"www.example.com/");
20+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp