From f20fd8e330f2af32c7651a88f3e4aa0e27117265 Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Mon, 4 Aug 2025 12:16:19 -0400 Subject: [PATCH] Throw when parsing URNs with slashes Signed-off-by: Juan Cruz Viotti --- test/uri/uri_parse_test.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/uri/uri_parse_test.cc b/test/uri/uri_parse_test.cc index a9acfb115..7e85c6dae 100644 --- a/test/uri/uri_parse_test.cc +++ b/test/uri/uri_parse_test.cc @@ -34,6 +34,13 @@ TEST(URI_parse, syntax_error_4) { // Inspired from // https://github.com/uriparser/uriparser/blob/bf0174e83164a4659c51c135399478bec389eafa/test/test.cpp#L315 +TEST(URI_parse, syntax_error_5) { + EXPECT_THROW( + sourcemeta::core::URI uri{ + "urn:sourcemeta:foo/bar.json"}, // the "/" is invalid + sourcemeta::core::URIParseError); +} + TEST(URI_parse, success_1) { sourcemeta::core::URI uri{ "//user:pass@[::1]:80/segment/index.html?query#frag"};