Skip to content

Commit

Permalink
0.179.0 -> 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
danielaparker committed Dec 1, 2024
1 parent a68e42f commit 57b2b18
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/jsoncons/utility/uri.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ namespace jsoncons { namespace utility {
if (!base.encoded_authority().empty() && base.encoded_path().empty())
{
result = "/";
result.append(relative.encoded_path().data(), relative.encoded_path().length());
//result.append(relative.encoded_path().data(), relative.encoded_path().length());
}
else
{
Expand Down
27 changes: 27 additions & 0 deletions test/corelib/src/utility/uri_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,33 @@ TEST_CASE("uri base tests")

TEST_CASE("uri resolve tests")
{
SECTION("empty base")
{
jsoncons::uri base{ "" };
jsoncons::uri rel{"dir1/other.schema.json"};
jsoncons::uri uri = rel.resolve(base);
CHECK(uri.base().string() == "dir1/other.schema.json");
CHECK(uri.path() == "dir1/other.schema.json");
}

SECTION("base has no authority and no path")
{
jsoncons::uri base{ "https" };
jsoncons::uri rel{ "dir1/other.schema.json" };
jsoncons::uri uri = rel.resolve(base);
CHECK(uri.base().string() == "dir1/other.schema.json");
CHECK(uri.path() == "dir1/other.schema.json");
}

SECTION("base has authority and path")
{
jsoncons::uri base{ "https://root" };
jsoncons::uri rel{"dir1/other.schema.json"};
jsoncons::uri uri = rel.resolve(base);
CHECK(uri.base().string() == "https://root/dir1/other.schema.json");
CHECK(uri.path() == "/dir1/other.schema.json");
}

SECTION("folder/")
{
jsoncons::uri base_uri("http://localhost:1234/scope_change_defs2.json");
Expand Down

0 comments on commit 57b2b18

Please sign in to comment.