diff options
Diffstat (limited to 'tests/library/corpora')
| -rw-r--r-- | tests/library/corpora/hostname.toml | 15 | ||||
| -rw-r--r-- | tests/library/corpora/isbn.toml | 13 | ||||
| -rw-r--r-- | tests/library/corpora/phone.toml | 25 | ||||
| -rw-r--r-- | tests/library/corpora/port.toml | 17 | ||||
| -rw-r--r-- | tests/library/corpora/postal.toml | 35 | ||||
| -rw-r--r-- | tests/library/corpora/semver.toml | 18 | ||||
| -rw-r--r-- | tests/library/corpora/slug.toml | 17 | ||||
| -rw-r--r-- | tests/library/corpora/vin.toml | 11 |
8 files changed, 148 insertions, 3 deletions
diff --git a/tests/library/corpora/hostname.toml b/tests/library/corpora/hostname.toml new file mode 100644 index 0000000..23da560 --- /dev/null +++ b/tests/library/corpora/hostname.toml @@ -0,0 +1,15 @@ +accepts = [ + "example.com", + "sub.example.co.uk", + "localhost", + "a.b.c", + "xn--d1acufc.example", +] + +rejects = [ + "", + "-bad.com", + ".com", + "a..b", + "exa mple.com", +] diff --git a/tests/library/corpora/isbn.toml b/tests/library/corpora/isbn.toml new file mode 100644 index 0000000..9028bc5 --- /dev/null +++ b/tests/library/corpora/isbn.toml @@ -0,0 +1,13 @@ +accepts = [ + "978-3-16-148410-0", + "0-306-40615-2", + "9783161484100", + "0306406152", +] + +rejects = [ + "", + "123", + "abc", + "978-3-16-148410-X", +] diff --git a/tests/library/corpora/phone.toml b/tests/library/corpora/phone.toml index 7abe2f7..f7f2b35 100644 --- a/tests/library/corpora/phone.toml +++ b/tests/library/corpora/phone.toml @@ -1,17 +1,36 @@ accepts = [ "+1 555 123 4567", - "+44 20 7946 0958", + "+1-555-123-4567", "555-123-4567", "555.123.4567", - "+1-555-123-4567", + "(555) 123-4567", "5551234567", + "1-800-555-0199", + "+44 20 7946 0958", + "+44 (0)20 7946 0958", "+81 3-1234-5678", + "+91 98765 43210", + "+49 30 12345678", + "+33 1 42 68 53 00", + "+61 2 9374 4000", + "+55 11 91234-5678", + "00 1 555 123 4567", + "112", + "911", + "999", + "311", + "08000", ] rejects = [ "", + " ", "not a phone", "abc-def-ghij", - " ", "555--123--4567", + "++15551234567", + "+", + "1", + "555-", + "(555 123-4567", ] diff --git a/tests/library/corpora/port.toml b/tests/library/corpora/port.toml new file mode 100644 index 0000000..4c715cc --- /dev/null +++ b/tests/library/corpora/port.toml @@ -0,0 +1,17 @@ +accepts = [ + "0", + "1", + "80", + "443", + "8080", + "65535", +] + +rejects = [ + "", + "65536", + "99999", + "-1", + "abc", + "8080a", +] diff --git a/tests/library/corpora/postal.toml b/tests/library/corpora/postal.toml new file mode 100644 index 0000000..5bf05fd --- /dev/null +++ b/tests/library/corpora/postal.toml @@ -0,0 +1,35 @@ +accepts = [ + "90210", + "90210-1234", + "10115", + "75008", + "110001", + "1011 AB", + "NL-1011 AB", + "SW1A 1AA", + "EC1A 1BB", + "GIR 0AA", + "K1A 0B1", + "D02 AF30", + "100-0001", + "01310-100", + "2000", + "00184", + "28001", + "114 55", + "00-001", + "101000", +] + +rejects = [ + "", + " ", + "notazip", + "abcde", + "!!!!!", + "90210-12", + "90210-", + "ZZ99 9ZZ", + "123456789", + "----", +] diff --git a/tests/library/corpora/semver.toml b/tests/library/corpora/semver.toml new file mode 100644 index 0000000..287c6c2 --- /dev/null +++ b/tests/library/corpora/semver.toml @@ -0,0 +1,18 @@ +accepts = [ + "1.0.0", + "2.1.3", + "10.20.30", + "1.0.0-alpha", + "1.0.0-alpha.1", + "1.0.0-rc.1+build.5", + "1.0.0+build.1", +] + +rejects = [ + "", + "1", + "1.0", + "v1.0.0", + "1.0.0.0", + "01.0.0", +] diff --git a/tests/library/corpora/slug.toml b/tests/library/corpora/slug.toml new file mode 100644 index 0000000..87d5407 --- /dev/null +++ b/tests/library/corpora/slug.toml @@ -0,0 +1,17 @@ +accepts = [ + "hello-world", + "my-post-123", + "a", + "abc", + "x-y-z", +] + +rejects = [ + "", + " ", + "Hello-World", + "hello_world", + "-abc", + "abc-", + "a--b", +] diff --git a/tests/library/corpora/vin.toml b/tests/library/corpora/vin.toml new file mode 100644 index 0000000..bc5909e --- /dev/null +++ b/tests/library/corpora/vin.toml @@ -0,0 +1,11 @@ +accepts = [ + "1HGBH41JXMN109186", + "5YJSA1E26HF000001", +] + +rejects = [ + "", + "1HGBH41JXMN10918", + "ABC", + "1HGBH41JXMN109186Q", +] |
