Merge branch 'main' into ragel-email-parser

This commit is contained in:
Gene Hightower 2022-11-11 09:38:02 -08:00
commit 7fe00099b5
3 changed files with 18 additions and 1 deletions

View File

@ -213,6 +213,8 @@ void default_string_format_check(const std::string &format, const std::string &v
rfc3339_date_check(value);
} else if (format == "time") {
rfc3339_time_check(value);
} else if (format == "uri") {
rfc3986_uri_check(value);
} else if (format == "email") {
if (!is_ascii(value)) {
throw std::invalid_argument(value + " contains non-ASCII values, not RFC 5321 compliant.");

View File

@ -61,7 +61,6 @@ if(JSON_SCHEMA_TEST_SUITE_PATH)
JSON-Suite::Optional::Format::relative-json-pointer
JSON-Suite::Optional::Format::uri-reference
JSON-Suite::Optional::Format::uri-template
JSON-Suite::Optional::Format::uri
JSON-Suite::Optional::unicode
PROPERTIES

View File

@ -82,5 +82,21 @@ int main()
numberOfErrors += testStringFormat("ipv4", ipv4Checks);
const std::vector<std::pair<std::string, bool>> uriChecks{
{"http://www.google.com/search?q=regular%20expression", true},
{"http://www.google.com/", true},
{"http://www.google.com/search?q=regular%20expression", true},
{"www.google.com", false},
{"http://www.google.comj", true},
{"ldap://[2001:db8::7]/c=GB?objectClass?one", true},
{"mailto:John.Doe@example.com", true},
{"news:comp.infosystems.www.servers.unix", true},
{"https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top", true},
{"tel:+1-816-555-1212", true},
{"telnet://192.0.2.16:80/", true},
{"urn:oasis:names:specification:docbook:dtd:xml:4.1.2", true}};
numberOfErrors += testStringFormat("uri", uriChecks);
return numberOfErrors;
}