Skip to content

Commit 41db295

Browse files
authored
Test URI::relative_to with absolute URIs and trailing slashes (#1579)
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent 5a3472c commit 41db295

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/uri/uri_relative_to_test.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,14 @@ TEST(URI_relative_to, urn_1) {
9191
uri.relative_to(base);
9292
EXPECT_EQ(uri.recompose(), "myschema");
9393
}
94+
95+
TEST(URI_relative_to, absolute_absolute_trailing_slash) {
96+
const sourcemeta::core::URI base{
97+
"https://github.com/apis-json/api-json/blob/develop/spec"};
98+
sourcemeta::core::URI uri{
99+
"https://github.com/apis-json/api-json/blob/develop/spec/"};
100+
uri.relative_to(base);
101+
// This is the result in Node.js URI parser too
102+
EXPECT_EQ(uri.recompose(),
103+
"https://github.com/apis-json/api-json/blob/develop/spec/");
104+
}

0 commit comments

Comments
 (0)