From b8611c407f86d47cace0ccb3d2248acf2a4cb9ef Mon Sep 17 00:00:00 2001 From: Paul Schwabauer Date: Mon, 23 Jun 2025 12:39:15 +0200 Subject: [PATCH] Extend URI and URI-reference tests Add tests that check if the URI contains invalid characters. --- .../optional/format/uri-reference.json | 10 ++++ tests/draft-next/optional/format/uri.json | 50 +++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/tests/draft-next/optional/format/uri-reference.json b/tests/draft-next/optional/format/uri-reference.json index 8d9d254e..e966532a 100644 --- a/tests/draft-next/optional/format/uri-reference.json +++ b/tests/draft-next/optional/format/uri-reference.json @@ -70,6 +70,16 @@ "description": "an invalid URI fragment", "data": "#frag\\ment", "valid": false + }, + { + "description": "unescaped non US-ASCII characters", + "data": "/foobar®.txt", + "valid": false + }, + { + "description": "invalid backslash character", + "data": "https://example.org/foobar\\.txt", + "valid": false } ] } diff --git a/tests/draft-next/optional/format/uri.json b/tests/draft-next/optional/format/uri.json index 50908eab..ca9beea1 100644 --- a/tests/draft-next/optional/format/uri.json +++ b/tests/draft-next/optional/format/uri.json @@ -135,6 +135,56 @@ "description": "an invalid URI with comma in scheme", "data": "bar,baz:foo", "valid": false + }, + { + "description": "invalid userinfo", + "data": "https://[@example.org/test.txt", + "valid": false + }, + { + "description": "unescaped non US-ASCII characters", + "data": "https://example.org/foobar®.txt", + "valid": false + }, + { + "description": "invalid backslash character", + "data": "https://example.org/foobar\\.txt", + "valid": false + }, + { + "description": "invalid \" character", + "data": "https://example.org/foobar\".txt", + "valid": false + }, + { + "description": "invalid <> characters", + "data": "https://example.org/foobar<>.txt", + "valid": false + }, + { + "description": "invalid {} characters", + "data": "https://example.org/foobar{}.txt", + "valid": false + }, + { + "description": "invalid ^ character", + "data": "https://example.org/foobar^.txt", + "valid": false + }, + { + "description": "invalid ` character", + "data": "https://example.org/foobar`.txt", + "valid": false + }, + { + "description": "invalid SPACE character", + "data": "https://example.org/foo bar.txt", + "valid": false + }, + { + "description": "invalid | character", + "data": "https://example.org/foobar|.txt", + "valid": false } ] }