summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2022-06-29 20:05:19 +0300
committerEd Tanous <edtanous@google.com>2022-12-15 23:03:47 +0300
commit079360ae6e04d3f2245e00d70f83d15c5cad3630 (patch)
treefcc89ce4e23a8fc63f18ad7ccf5cd044457861f0 /test
parent0fb5b5051bebfe1330627a02d8f7c83195f71ed3 (diff)
downloadbmcweb-079360ae6e04d3f2245e00d70f83d15c5cad3630.tar.xz
Prepare for boost::url upgrade
The new boost URL now interops properly with std::string_view, which is great, and cleans up a bunch of mediocre code to convert one to another. It has also been pulled into boost-proper, so we no longer need a boost-url dependency that's separate. Unfortunately, boost url makes these improvements by changing boost::string_view for boost::urls::const_string, which causes us to have some compile errors on the missing type. The bulk of these changes fall into a couple categories, and have to be executed in one commit. string() is replaced with buffer() on the url and url_view types boost::string_view is replaced by std::string_view for many times, in many cases removing a temporary that we had in the code previously. Tested: Code compiles with boost 1.81.0 beta. Redfish service validator passes. Pretty good unit test coverage for URL-specific use cases. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8d3dc89b53d1cc390887fe53605d4867f75f76fd
Diffstat (limited to 'test')
-rw-r--r--test/http/utility_test.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/http/utility_test.cpp b/test/http/utility_test.cpp
index 58a28654e1..2e0c82e4d7 100644
--- a/test/http/utility_test.cpp
+++ b/test/http/utility_test.cpp
@@ -84,16 +84,16 @@ TEST(Utility, Base64EncodeDecodeString)
TEST(Utility, UrlFromPieces)
{
boost::urls::url url = urlFromPieces("redfish", "v1", "foo");
- EXPECT_EQ(std::string_view(url.data(), url.size()), "/redfish/v1/foo");
+ EXPECT_EQ(url.buffer(), "/redfish/v1/foo");
url = urlFromPieces("/", "badString");
- EXPECT_EQ(std::string_view(url.data(), url.size()), "/%2f/badString");
+ EXPECT_EQ(url.buffer(), "/%2F/badString");
url = urlFromPieces("bad?tring");
- EXPECT_EQ(std::string_view(url.data(), url.size()), "/bad%3ftring");
+ EXPECT_EQ(url.buffer(), "/bad%3Ftring");
url = urlFromPieces("/", "bad&tring");
- EXPECT_EQ(std::string_view(url.data(), url.size()), "/%2f/bad&tring");
+ EXPECT_EQ(url.buffer(), "/%2F/bad&tring");
}
TEST(Utility, readUrlSegments)
@@ -232,7 +232,7 @@ TEST(AppendUrlFromPieces, PiecesAreAppendedViaDelimiters)
appendUrlPieces(url, "/", "bad&tring");
EXPECT_EQ(std::string_view(url.data(), url.size()),
- "/redfish/v1/foo/bar/%2f/bad&tring");
+ "/redfish/v1/foo/bar/%2F/bad&tring");
}
} // namespace