Skip to content

adds more valid and invalid URI testcases #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 76 additions & 1 deletion tests/draft4/optional/format.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,80 @@
"schema": {"format": "uri"},
"tests": [
{
"description": "a valid URI",
"description": "a valid URL with anchor tag",
"data": "http://foo.bar/?baz=qux#quux",
"valid": true
},
{
"description": "a valid URL with anchor tag and parantheses",
"data": "http://foo.com/blah_(wikipedia)_blah#cite-1",
"valid": true
},
{
"description": "a valid URL with URL-encoded stuff",
"data": "http://foo.bar/?q=Test%20URL-encoded%20stuff",
"valid": true
},
{
"description": "a valid puny-coded URL ",
"data": "http://xn--nw2a.xn--j6w193g/",
"valid": true
},
{
"description": "a valid URL with many special characters",
"data": "http://-.~_!$&'()*+,;=:%40:80%2f::::::@example.com",
"valid": true
},
{
"description": "a valid URL based on IPv4",
"data": "http://223.255.255.254",
"valid": true
},
{
"description": "a valid URL with ftp scheme",
"data": "ftp://ftp.is.co.za/rfc/rfc1808.txt",
"valid": true
},
{
"description": "a valid URL for a simple text file",
"data": "http://www.ietf.org/rfc/rfc2396.txt",
"valid": true
},
{
"description": "a valid URL ",
"data": "ldap://[2001:db8::7]/c=GB?objectClass?one",
"valid": true
},
{
"description": "a valid mailto URI",
"data": "mailto:John.Doe@example.com",
"valid": true
},
{
"description": "a valid newsgroup URI",
"data": "news:comp.infosystems.www.servers.unix",
"valid": true
},
{
"description": "a valid tel URI",
"data": "tel:+1-816-555-1212",
"valid": true
},
{
"description": "a valid URN",
"data": "urn:oasis:names:specification:docbook:dtd:xml:4.1.2",
"valid": true
},
{
"description": "an invalid protocol-relative URI Reference",
"data": "//foo.bar/?baz=qux#quux",
"valid": false
},
{
"description": "an invalid relative URI Reference",
"data": "/abc",
"valid": false
},
{
"description": "an invalid URI",
"data": "\\\\WINDOWS\\fileshare",
Expand All @@ -43,6 +108,16 @@
"description": "an invalid URI though valid URI reference",
"data": "abc",
"valid": false
},
{
"description": "an invalid URI with spaces",
"data": "http:// shouldfail.com",
"valid": false
},
{
"description": "an invalid URI with spaces and missing scheme",
"data": ":// should fail",
"valid": false
}
]
},
Expand Down
72 changes: 71 additions & 1 deletion tests/draft6/optional/format.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,70 @@
"schema": {"format": "uri"},
"tests": [
{
"description": "a valid URI",
"description": "a valid URL with anchor tag",
"data": "http://foo.bar/?baz=qux#quux",
"valid": true
},
{
"description": "a valid URL with anchor tag and parantheses",
"data": "http://foo.com/blah_(wikipedia)_blah#cite-1",
"valid": true
},
{
"description": "a valid URL with URL-encoded stuff",
"data": "http://foo.bar/?q=Test%20URL-encoded%20stuff",
"valid": true
},
{
"description": "a valid puny-coded URL ",
"data": "http://xn--nw2a.xn--j6w193g/",
"valid": true
},
{
"description": "a valid URL with many special characters",
"data": "http://-.~_!$&'()*+,;=:%40:80%2f::::::@example.com",
"valid": true
},
{
"description": "a valid URL based on IPv4",
"data": "http://223.255.255.254",
"valid": true
},
{
"description": "a valid URL with ftp scheme",
"data": "ftp://ftp.is.co.za/rfc/rfc1808.txt",
"valid": true
},
{
"description": "a valid URL for a simple text file",
"data": "http://www.ietf.org/rfc/rfc2396.txt",
"valid": true
},
{
"description": "a valid URL ",
"data": "ldap://[2001:db8::7]/c=GB?objectClass?one",
"valid": true
},
{
"description": "a valid mailto URI",
"data": "mailto:John.Doe@example.com",
"valid": true
},
{
"description": "a valid newsgroup URI",
"data": "news:comp.infosystems.www.servers.unix",
"valid": true
},
{
"description": "a valid tel URI",
"data": "tel:+1-816-555-1212",
"valid": true
},
{
"description": "a valid URN",
"data": "urn:oasis:names:specification:docbook:dtd:xml:4.1.2",
"valid": true
},
{
"description": "an invalid protocol-relative URI Reference",
"data": "//foo.bar/?baz=qux#quux",
Expand All @@ -48,6 +108,16 @@
"description": "an invalid URI though valid URI reference",
"data": "abc",
"valid": false
},
{
"description": "an invalid URI with spaces",
"data": "http:// shouldfail.com",
"valid": false
},
{
"description": "an invalid URI with spaces and missing scheme",
"data": ":// should fail",
"valid": false
}
]
},
Expand Down