├── .editorconfig ├── .github └── workflows │ └── test.yml ├── LICENSE.md ├── README.md ├── binary.json ├── boolean.json ├── date.json ├── dictionary.json ├── display-string.json ├── examples.json ├── generate.py ├── item.json ├── key-generated.json ├── large-generated.json ├── list.json ├── listlist.json ├── number-generated.json ├── number.json ├── param-dict.json ├── param-list.json ├── param-listlist.json ├── schema ├── .gitignore ├── README.md ├── expected.schema.json ├── package.json ├── parse.schema.json └── serialize.schema.json ├── serialisation-tests ├── key-generated.json ├── number.json ├── string-generated.json └── token-generated.json ├── string-generated.json ├── string.json ├── token-generated.json └── token.json /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = LF 5 | indent_style = space 6 | indent_size = 4 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Validation Tests 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | defaults: 13 | run: 14 | working-directory: 'schema' 15 | steps: 16 | - uses: actions/checkout@v4 17 | - uses: actions/setup-node@v4 18 | - run: npm install 19 | - run: npm test 20 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018- IETF Trust and the persons identified as authors of the code. All rights 2 | reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted 5 | provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this list of conditions 8 | and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions 11 | and the following disclaimer in the documentation and/or other materials provided with the 12 | distribution. 13 | 14 | * Neither the name of Internet Society, IETF or IETF Trust, nor the names of specific contributors, 15 | may be used to endorse or promote products derived from this software without specific prior 16 | written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 21 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 | OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Structured Field Tests 2 | 3 | These are test cases for implementations of [Structured Fields for HTTP](https://httpwg.org/specs/rfc9651.html). 4 | 5 | ## Test Format 6 | 7 | Each test file is a JSON document that contains an array of test records. A test record is an 8 | object with the following members: 9 | 10 | - `name`: A string describing the test 11 | - `raw`: An array of strings, each representing a field value received 12 | - `header_type`: One of "item", "list", "dictionary" 13 | - `expected`: The expected data structure after parsing (if successful). Required, unless `must_fail` is `true`. 14 | - `must_fail`: boolean indicating whether the test is required to fail. Defaults to `false`. 15 | - `can_fail`: boolean indicating whether failing this test is acceptable; for SHOULDs. Defaults to `false`. 16 | - `canonical`: An array of strings representing the canonical form of the field value, if it is different from `raw`. Not applicable if `must_fail` is `true`. 17 | 18 | The `expected` data structure maps the types in Structured Fields to [JSON](https://tools.ietf.org/html/rfc8259) as follows: 19 | 20 | * Dictionary: JSON array of arrays with two elements, the member name and the member value 21 | * List: JSON array, where each element is either an Item or Inner-List 22 | * Inner-List: JSON array of arrays with two elements, the list (a JSON array of Items) and Parameters 23 | * Item: JSON array with two elements, the Bare-Item and Parameters 24 | * Bare-Item: one of: 25 | * Integer: JSON numbers; e.g. 1 26 | * Float: JSON numbers; e.g. 2.5 27 | * String: JSON string; e.g., "foo" 28 | * Token: `token` __type Object (see below) 29 | * Binary Content: `binary` __type Object (see below) 30 | * Boolean: JSON boolean; e.g., true 31 | * Date: `date` __type Object (see below) 32 | * Display String: `displaystring` __type Object (see below) 33 | * Parameters: JSON array of arrays with two element, the param name and the param value 34 | 35 | For any test that case that has a valid outcome (i.e. `must_fail` is not `true`) the `expected` 36 | data structure can be serialised. The expected result of this serialisation is the `canonical` 37 | member if specified, or `raw` otherwise. The canonical form of a List or Dictionary with no 38 | members is an empty array, to represent the field being omitted. 39 | 40 | Test cases in the `serialisation-tests` directory can be used to test serialisation of an invalid 41 | or non-canonical value. The `expected` structure (as defined above) should serialise to the 42 | `canonical` form, unless `must_fail` is `true` -- in which case the value cannot be serialised. 43 | These cases do not have a `raw` element. 44 | 45 | [JSON Schemas](https://json-schema.org/) for these formats are provided in the `schemas` directory. 46 | 47 | ### __type Objects 48 | 49 | Because JSON doesn't natively accommodate some data types that Structured Fields does, the `expected` member uses an object with a `__type` member and a `value` member to represent these values. 50 | 51 | For example: 52 | 53 | ~~~ 54 | { 55 | "__type": "token", 56 | "value": "foo" 57 | } 58 | ~~~ 59 | 60 | ... carries a "foo" token. The following types are defined: 61 | 62 | * `token`: carries a Token as a JSON string; e.g., "bar" 63 | * `binary`: carries Binary Content as a **[base32](https://www.rfc-editor.org/rfc/rfc4648.html#section-6)**-encoded JSON string; e.g., "ZXW6===" 64 | * `date`: Carries a Date as a JSON integer; e.g., 1692859242 65 | * `displaystring`: Carries a Display String as a JSON string; e.g. "Füü" 66 | 67 | 68 | ## Writing Tests 69 | 70 | All tests should have a descriptive name. Tests should be as simple as possible - just what's 71 | required to test a specific piece of behavior. If you want to test interacting behaviors, create 72 | tests for each behavior as well as the interaction. 73 | 74 | If a test file ends in `-generated.json`, please modify `generate.py` *and* re-generate the tests in your PR. 75 | 76 | Please feel free to contribute! 77 | -------------------------------------------------------------------------------- /binary.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "basic binary", 4 | "raw": [":aGVsbG8=:"], 5 | "header_type": "item", 6 | "expected": [ 7 | {"__type": "binary", "value": "NBSWY3DP"}, 8 | []] 9 | }, 10 | { 11 | "name": "empty binary", 12 | "raw": ["::"], 13 | "header_type": "item", 14 | "expected": [ 15 | {"__type": "binary", "value": ""}, 16 | []] 17 | }, 18 | { 19 | "name": "padding at beginning", 20 | "raw": [":=aGVsbG8=:"], 21 | "header_type": "item", 22 | "must_fail": true 23 | }, 24 | { 25 | "name": "padding in middle", 26 | "raw": [":a=GVsbG8=:"], 27 | "header_type": "item", 28 | "must_fail": true 29 | }, 30 | { 31 | "name": "bad padding", 32 | "raw": [":aGVsbG8:"], 33 | "header_type": "item", 34 | "expected": [ 35 | {"__type": "binary", "value": "NBSWY3DP"}, 36 | []], 37 | "can_fail": true, 38 | "canonical": [":aGVsbG8=:"] 39 | }, 40 | { 41 | "name": "bad padding dot", 42 | "raw": [":aGVsbG8.:"], 43 | "header_type": "item", 44 | "must_fail": true 45 | }, 46 | { 47 | "name": "bad end delimiter", 48 | "raw": [":aGVsbG8="], 49 | "header_type": "item", 50 | "must_fail": true 51 | }, 52 | { 53 | "name": "extra whitespace", 54 | "raw": [":aGVsb G8=:"], 55 | "header_type": "item", 56 | "must_fail": true 57 | }, 58 | { 59 | "name": "all whitespace", 60 | "raw": [": :"], 61 | "header_type": "item", 62 | "must_fail": true 63 | }, 64 | { 65 | "name": "extra chars", 66 | "raw": [":aGVsbG!8=:"], 67 | "header_type": "item", 68 | "must_fail": true 69 | }, 70 | { 71 | "name": "suffix chars", 72 | "raw": [":aGVsbG8=!:"], 73 | "header_type": "item", 74 | "must_fail": true 75 | }, 76 | { 77 | "name": "non-zero pad bits", 78 | "raw": [":iZ==:"], 79 | "header_type": "item", 80 | "expected": [ 81 | {"__type": "binary", "value": "RE======"}, 82 | []], 83 | "can_fail": true, 84 | "canonical": [":iQ==:"] 85 | }, 86 | { 87 | "name": "non-ASCII binary", 88 | "raw": [":/+Ah:"], 89 | "header_type": "item", 90 | "expected": [ 91 | {"__type": "binary", "value": "77QCC==="}, 92 | []] 93 | }, 94 | { 95 | "name": "base64url binary", 96 | "raw": [":_-Ah:"], 97 | "header_type": "item", 98 | "must_fail": true 99 | } 100 | ] 101 | -------------------------------------------------------------------------------- /boolean.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "basic true boolean", 4 | "raw": ["?1"], 5 | "header_type": "item", 6 | "expected": [true, []] 7 | }, 8 | { 9 | "name": "basic false boolean", 10 | "raw": ["?0"], 11 | "header_type": "item", 12 | "expected": [false, []] 13 | }, 14 | { 15 | "name": "unknown boolean", 16 | "raw": ["?Q"], 17 | "header_type": "item", 18 | "must_fail": true 19 | }, 20 | { 21 | "name": "whitespace boolean", 22 | "raw": ["? 1"], 23 | "header_type": "item", 24 | "must_fail": true 25 | }, 26 | { 27 | "name": "negative zero boolean", 28 | "raw": ["?-0"], 29 | "header_type": "item", 30 | "must_fail": true 31 | }, 32 | { 33 | "name": "T boolean", 34 | "raw": ["?T"], 35 | "header_type": "item", 36 | "must_fail": true 37 | }, 38 | { 39 | "name": "F boolean", 40 | "raw": ["?F"], 41 | "header_type": "item", 42 | "must_fail": true 43 | }, 44 | { 45 | "name": "t boolean", 46 | "raw": ["?t"], 47 | "header_type": "item", 48 | "must_fail": true 49 | }, 50 | { 51 | "name": "f boolean", 52 | "raw": ["?f"], 53 | "header_type": "item", 54 | "must_fail": true 55 | }, 56 | { 57 | "name": "spelled-out True boolean", 58 | "raw": ["?True"], 59 | "header_type": "item", 60 | "must_fail": true 61 | }, 62 | { 63 | "name": "spelled-out False boolean", 64 | "raw": ["?False"], 65 | "header_type": "item", 66 | "must_fail": true 67 | } 68 | ] 69 | 70 | -------------------------------------------------------------------------------- /date.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "date - 1970-01-01 00:00:00", 4 | "raw": ["@0"], 5 | "header_type": "item", 6 | "expected": [{"__type": "date", "value": 0}, []] 7 | }, 8 | { 9 | "name": "date - 2022-08-04 01:57:13", 10 | "raw": ["@1659578233"], 11 | "header_type": "item", 12 | "expected": [{"__type": "date", "value": 1659578233}, []] 13 | }, 14 | { 15 | "name": "date - 1917-05-30 22:02:47", 16 | "raw": ["@-1659578233"], 17 | "header_type": "item", 18 | "expected": [{"__type": "date", "value": -1659578233}, []] 19 | }, 20 | { 21 | "name": "date - 2^31", 22 | "raw": ["@2147483648"], 23 | "header_type": "item", 24 | "expected": [{"__type": "date", "value": 2147483648}, []] 25 | }, 26 | { 27 | "name": "date - 2^32", 28 | "raw": ["@4294967296"], 29 | "header_type": "item", 30 | "expected": [{"__type": "date", "value": 4294967296}, []] 31 | }, 32 | { 33 | "name": "large date - 9999-12-31 00:00:00", 34 | "raw": ["@253402214400"], 35 | "header_type": "item", 36 | "expected": [{"__type": "date", "value": 253402214400}, []] 37 | }, 38 | { 39 | "name": "small date - 0001-01-01 00:00:00", 40 | "raw": ["@-62135596800"], 41 | "header_type": "item", 42 | "expected": [{"__type": "date", "value": -62135596800}, []] 43 | }, 44 | { 45 | "name": "date - decimal", 46 | "raw": ["@1659578233.12"], 47 | "header_type": "item", 48 | "must_fail": true 49 | } 50 | ] 51 | -------------------------------------------------------------------------------- /dictionary.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "basic dictionary", 4 | "raw": ["en=\"Applepie\", da=:w4ZibGV0w6ZydGUK:"], 5 | "header_type": "dictionary", 6 | "expected": [["en", ["Applepie", []]], ["da", [ 7 | {"__type": "binary", "value": "YODGE3DFOTB2M4TUMUFA===="}, 8 | []] 9 | ]] 10 | }, 11 | { 12 | "name": "empty dictionary", 13 | "raw": [""], 14 | "header_type": "dictionary", 15 | "expected": [], 16 | "canonical": [] 17 | }, 18 | { 19 | "name": "single item dictionary", 20 | "raw": ["a=1"], 21 | "header_type": "dictionary", 22 | "expected": [["a", [1, []]]] 23 | }, 24 | { 25 | "name": "list item dictionary", 26 | "raw": ["a=(1 2)"], 27 | "header_type": "dictionary", 28 | "expected": [["a", [[[1, []], [2, []]], []]]] 29 | }, 30 | { 31 | "name": "single list item dictionary", 32 | "raw": ["a=(1)"], 33 | "header_type": "dictionary", 34 | "expected": [["a", [[[1, []]], []]]] 35 | }, 36 | { 37 | "name": "empty list item dictionary", 38 | "raw": ["a=()"], 39 | "header_type": "dictionary", 40 | "expected": [["a", [[], []]]] 41 | }, 42 | { 43 | "name": "no whitespace dictionary", 44 | "raw": ["a=1,b=2"], 45 | "header_type": "dictionary", 46 | "expected": [["a", [1, []]], ["b", [2, []]]], 47 | "canonical": ["a=1, b=2"] 48 | }, 49 | { 50 | "name": "extra whitespace dictionary", 51 | "raw": ["a=1 , b=2"], 52 | "header_type": "dictionary", 53 | "expected": [["a", [1, []]], ["b", [2, []]]], 54 | "canonical": ["a=1, b=2"] 55 | }, 56 | { 57 | "name": "tab separated dictionary", 58 | "raw": ["a=1\t,\tb=2"], 59 | "header_type": "dictionary", 60 | "expected": [["a", [1, []]], ["b", [2, []]]], 61 | "canonical": ["a=1, b=2"] 62 | }, 63 | { 64 | "name": "leading whitespace dictionary", 65 | "raw": [" a=1 , b=2"], 66 | "header_type": "dictionary", 67 | "expected": [["a", [1, []]], ["b", [2, []]]], 68 | "canonical": ["a=1, b=2"] 69 | }, 70 | { 71 | "name": "whitespace before = dictionary", 72 | "raw": ["a =1, b=2"], 73 | "header_type": "dictionary", 74 | "must_fail": true 75 | }, 76 | { 77 | "name": "whitespace after = dictionary", 78 | "raw": ["a=1, b= 2"], 79 | "header_type": "dictionary", 80 | "must_fail": true 81 | }, 82 | { 83 | "name": "two lines dictionary", 84 | "raw": ["a=1", "b=2"], 85 | "header_type": "dictionary", 86 | "expected": [["a", [1, []]], ["b", [2, []]]], 87 | "canonical": ["a=1, b=2"] 88 | }, 89 | { 90 | "name": "missing value dictionary", 91 | "raw": ["a=1, b, c=3"], 92 | "header_type": "dictionary", 93 | "expected": [["a", [1, []]], ["b", [true, []]], ["c", [3, []]]] 94 | }, 95 | { 96 | "name": "all missing value dictionary", 97 | "raw": ["a, b, c"], 98 | "header_type": "dictionary", 99 | "expected": [["a", [true, []]], ["b", [true, []]], ["c", [true, []]]] 100 | }, 101 | { 102 | "name": "start missing value dictionary", 103 | "raw": ["a, b=2"], 104 | "header_type": "dictionary", 105 | "expected": [["a", [true, []]], ["b", [2, []]]] 106 | }, 107 | { 108 | "name": "end missing value dictionary", 109 | "raw": ["a=1, b"], 110 | "header_type": "dictionary", 111 | "expected": [["a", [1, []]], ["b", [true, []]]] 112 | }, 113 | { 114 | "name": "missing value with params dictionary", 115 | "raw": ["a=1, b;foo=9, c=3"], 116 | "header_type": "dictionary", 117 | "expected": [["a", [1, []]], ["b", [true, [["foo", 9]]]], ["c", [3, []]]] 118 | }, 119 | { 120 | "name": "explicit true value with params dictionary", 121 | "raw": ["a=1, b=?1;foo=9, c=3"], 122 | "header_type": "dictionary", 123 | "expected": [["a", [1, []]], ["b", [true, [["foo", 9]]]], ["c", [3, []]]], 124 | "canonical": ["a=1, b;foo=9, c=3"] 125 | }, 126 | { 127 | "name": "trailing comma dictionary", 128 | "raw": ["a=1, b=2,"], 129 | "header_type": "dictionary", 130 | "must_fail": true 131 | }, 132 | { 133 | "name": "empty item dictionary", 134 | "raw": ["a=1,,b=2,"], 135 | "header_type": "dictionary", 136 | "must_fail": true 137 | }, 138 | { 139 | "name": "duplicate key dictionary", 140 | "raw": ["a=1,b=2,a=3"], 141 | "header_type": "dictionary", 142 | "expected": [["a", [3, []]], ["b", [2, []]]], 143 | "canonical": ["a=3, b=2"] 144 | }, 145 | { 146 | "name": "numeric key dictionary", 147 | "raw": ["a=1,1b=2,a=1"], 148 | "header_type": "dictionary", 149 | "must_fail": true 150 | }, 151 | { 152 | "name": "uppercase key dictionary", 153 | "raw": ["a=1,B=2,a=1"], 154 | "header_type": "dictionary", 155 | "must_fail": true 156 | }, 157 | { 158 | "name": "bad key dictionary", 159 | "raw": ["a=1,b!=2,a=1"], 160 | "header_type": "dictionary", 161 | "must_fail": true 162 | } 163 | ] 164 | -------------------------------------------------------------------------------- /display-string.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "basic display string (ascii content)", 4 | "raw": ["%\"foo bar\""], 5 | "header_type": "item", 6 | "expected": [{"__type": "displaystring", "value": "foo bar"}, []] 7 | }, 8 | { 9 | "name": "all printable ascii", 10 | "raw": ["%\" !%22#$%25&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\""], 11 | "header_type": "item", 12 | "expected": [{"__type": "displaystring", "value": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"}, []] 13 | }, 14 | { 15 | "name": "non-ascii display string (uppercase escaping)", 16 | "raw": ["%\"f%C3%BC%C3%BC\""], 17 | "header_type": "item", 18 | "must_fail": true 19 | }, 20 | { 21 | "name": "non-ascii display string (lowercase escaping)", 22 | "raw": ["%\"f%c3%bc%c3%bc\""], 23 | "header_type": "item", 24 | "expected": [{"__type": "displaystring", "value": "füü"}, []] 25 | }, 26 | { 27 | "name": "non-ascii display string (unescaped)", 28 | "raw": ["%\"füü\""], 29 | "header_type": "item", 30 | "must_fail": true 31 | }, 32 | { 33 | "name": "tab in display string", 34 | "raw": ["%\"\t\""], 35 | "header_type": "item", 36 | "must_fail": true 37 | }, 38 | { 39 | "name": "newline in display string", 40 | "raw": ["%\"\n\""], 41 | "header_type": "item", 42 | "must_fail": true 43 | }, 44 | { 45 | "name": "single quoted display string", 46 | "raw": ["%'foo'"], 47 | "header_type": "item", 48 | "must_fail": true 49 | }, 50 | { 51 | "name": "unquoted display string", 52 | "raw": ["%foo"], 53 | "header_type": "item", 54 | "must_fail": true 55 | }, 56 | { 57 | "name": "display string missing initial quote", 58 | "raw": ["%foo\""], 59 | "header_type": "item", 60 | "must_fail": true 61 | }, 62 | { 63 | "name": "unbalanced display string", 64 | "raw": ["%\"foo"], 65 | "header_type": "item", 66 | "must_fail": true 67 | }, 68 | { 69 | "name": "display string quoting", 70 | "raw": ["%\"foo %22bar%22 \\ baz\""], 71 | "header_type": "item", 72 | "expected": [{"__type": "displaystring", "value": "foo \"bar\" \\ baz"}, []] 73 | }, 74 | { 75 | "name": "bad display string escaping", 76 | "raw": ["%\"foo %a"], 77 | "header_type": "item", 78 | "must_fail": true 79 | }, 80 | { 81 | "name": "bad display string utf-8 (invalid 2-byte seq)", 82 | "raw": ["%\"%c3%28\""], 83 | "header_type": "item", 84 | "must_fail": true 85 | }, 86 | { 87 | "name": "bad display string utf-8 (invalid sequence id)", 88 | "raw": ["%\"%a0%a1\""], 89 | "header_type": "item", 90 | "must_fail": true 91 | }, 92 | { 93 | "name": "bad display string utf-8 (invalid hex)", 94 | "raw": ["%\"%g0%1w\""], 95 | "header_type": "item", 96 | "must_fail": true 97 | }, 98 | { 99 | "name": "bad display string utf-8 (invalid 3-byte seq)", 100 | "raw": ["%\"%e2%28%a1\""], 101 | "header_type": "item", 102 | "must_fail": true 103 | }, 104 | { 105 | "name": "bad display string utf-8 (invalid 4-byte seq)", 106 | "raw": ["%\"%f0%28%8c%28\""], 107 | "header_type": "item", 108 | "must_fail": true 109 | }, 110 | { 111 | "name": "BOM in display string", 112 | "raw": ["%\"BOM: %ef%bb%bf\""], 113 | "header_type": "item", 114 | "expected": [{"__type": "displaystring", "value": "BOM: \uFEFF"}, []] 115 | }, 116 | { 117 | "name": "two lines display string", 118 | "raw": ["%\"foo", "bar\""], 119 | "header_type": "item", 120 | "can_fail": true, 121 | "expected": [{"__type": "displaystring", "value": "foo, bar"}, []] 122 | } 123 | ] 124 | -------------------------------------------------------------------------------- /examples.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "Foo-Example", 4 | "raw": ["2; foourl=\"https://foo.example.com/\""], 5 | "header_type": "item", 6 | "expected": [2, [["foourl", "https://foo.example.com/"]]], 7 | "canonical": ["2;foourl=\"https://foo.example.com/\""] 8 | }, 9 | { 10 | "name": "Example-StrListHeader", 11 | "raw": ["\"foo\", \"bar\", \"It was the best of times.\""], 12 | "header_type": "list", 13 | "expected": [ 14 | ["foo", []], 15 | ["bar", []], 16 | ["It was the best of times.", []] 17 | ] 18 | }, 19 | { 20 | "name": "Example-Hdr (list on one line)", 21 | "raw": ["foo, bar"], 22 | "header_type": "list", 23 | "expected": [ 24 | [{"__type":"token", "value":"foo"}, []], 25 | [{"__type":"token", "value":"bar"}, []] 26 | ] 27 | }, 28 | { 29 | "name": "Example-Hdr (list on two lines)", 30 | "raw": ["foo", "bar"], 31 | "header_type": "list", 32 | "expected": [ 33 | [{"__type":"token", "value":"foo"}, []], 34 | [{"__type":"token", "value":"bar"}, []] 35 | ], 36 | "canonical": ["foo, bar"] 37 | }, 38 | { 39 | "name": "Example-StrListListHeader", 40 | "raw": ["(\"foo\" \"bar\"), (\"baz\"), (\"bat\" \"one\"), ()"], 41 | "header_type": "list", 42 | "expected": [ 43 | [[ 44 | ["foo", []], 45 | ["bar", []] 46 | ], []], 47 | [[ 48 | ["baz", []] 49 | ], []], 50 | [[ 51 | ["bat", []], 52 | ["one", []] 53 | ], []], 54 | [[], []] 55 | ] 56 | }, 57 | { 58 | "name": "Example-ListListParam", 59 | "raw": ["(\"foo\"; a=1;b=2);lvl=5, (\"bar\" \"baz\");lvl=1"], 60 | "header_type": "list", 61 | "expected": [ 62 | [[ 63 | ["foo", [["a", 1], ["b", 2]]] 64 | ], [["lvl", 5]]], 65 | [[ 66 | ["bar", []], ["baz", []] 67 | ], [["lvl", 1]]] 68 | ], 69 | "canonical": ["(\"foo\";a=1;b=2);lvl=5, (\"bar\" \"baz\");lvl=1"] 70 | }, 71 | 72 | { 73 | "name": "Example-ParamListHeader", 74 | "raw": ["abc;a=1;b=2; cde_456, (ghi;jk=4 l);q=\"9\";r=w"], 75 | "header_type": "list", 76 | "expected": [ 77 | [{"__type": "token", "value": "abc"}, [["a", 1], ["b", 2], ["cde_456", true]]], 78 | [ 79 | [ 80 | [{"__type": "token", "value": "ghi"}, [["jk", 4]]], 81 | [{"__type": "token", "value": "l"}, []] 82 | ], 83 | [["q", "9"], ["r", {"__type": "token", "value": "w"}]] 84 | ] 85 | ], 86 | "canonical": ["abc;a=1;b=2;cde_456, (ghi;jk=4 l);q=\"9\";r=w"] 87 | }, 88 | { 89 | "name": "Example-IntHeader", 90 | "raw": ["1; a; b=?0"], 91 | "header_type": "item", 92 | "expected": [1, [["a", true], ["b", false]]], 93 | "canonical": ["1;a;b=?0"] 94 | }, 95 | { 96 | "name": "Example-DictHeader", 97 | "raw": ["en=\"Applepie\", da=:w4ZibGV0w6ZydGU=:"], 98 | "header_type": "dictionary", 99 | "expected": [ 100 | ["en", ["Applepie", []]], 101 | ["da", [{"__type": "binary", "value": "YODGE3DFOTB2M4TUMU======"}, []]] 102 | ] 103 | }, 104 | { 105 | "name": "Example-DictHeader (boolean values)", 106 | "raw": ["a=?0, b, c; foo=bar"], 107 | "header_type": "dictionary", 108 | "expected": [ 109 | ["a", [false, []]], 110 | ["b", [true, []]], 111 | ["c", [true, [["foo", {"__type": "token", "value": "bar"}]]]] 112 | ], 113 | "canonical": ["a=?0, b, c;foo=bar"] 114 | }, 115 | { 116 | "name": "Example-DictListHeader", 117 | "raw": ["rating=1.5, feelings=(joy sadness)"], 118 | "header_type": "dictionary", 119 | "expected": [ 120 | ["rating", [1.5, []]], 121 | ["feelings", [[ 122 | [{"__type": "token", "value": "joy"}, []], 123 | [{"__type": "token", "value": "sadness"}, []] 124 | ], []]] 125 | ] 126 | }, 127 | { 128 | "name": "Example-MixDict", 129 | "raw": ["a=(1 2), b=3, c=4;aa=bb, d=(5 6);valid"], 130 | "header_type": "dictionary", 131 | "expected": [ 132 | ["a", [[ 133 | [1, []], 134 | [2, []] 135 | ], []]], 136 | ["b", [3, []]], 137 | ["c", [4, [["aa", {"__type": "token", "value": "bb"}]]]], 138 | ["d", [[ 139 | [5, []], 140 | [6, []] 141 | ], [["valid", true]]]] 142 | ], 143 | "canonical": ["a=(1 2), b=3, c=4;aa=bb, d=(5 6);valid"] 144 | }, 145 | { 146 | "name": "Example-Hdr (dictionary on one line)", 147 | "raw": ["foo=1, bar=2"], 148 | "header_type": "dictionary", 149 | "expected": [ 150 | ["foo", [1, []]], 151 | ["bar", [2, []]] 152 | ] 153 | }, 154 | { 155 | "name": "Example-Hdr (dictionary on two lines)", 156 | "raw": ["foo=1", "bar=2"], 157 | "header_type": "dictionary", 158 | "expected": [ 159 | ["foo", [1, []]], 160 | ["bar", [2, []]] 161 | ], 162 | "canonical": ["foo=1, bar=2"] 163 | }, 164 | 165 | { 166 | "name": "Example-IntItemHeader", 167 | "raw": ["5"], 168 | "header_type": "item", 169 | "expected": [5, []] 170 | }, 171 | { 172 | "name": "Example-IntItemHeader (params)", 173 | "raw": ["5; foo=bar"], 174 | "header_type": "item", 175 | "expected": [5, [["foo", {"__type": "token", "value": "bar"}]]], 176 | "canonical": ["5;foo=bar"] 177 | }, 178 | { 179 | "name": "Example-IntegerHeader", 180 | "raw": ["42"], 181 | "header_type": "item", 182 | "expected": [42, []] 183 | }, 184 | { 185 | "name": "Example-FloatHeader", 186 | "raw": ["4.5"], 187 | "header_type": "item", 188 | "expected": [4.5, []] 189 | }, 190 | { 191 | "name": "Example-StringHeader", 192 | "raw": ["\"hello world\""], 193 | "header_type": "item", 194 | "expected": ["hello world", []] 195 | }, 196 | { 197 | "name": "Example-BinaryHdr", 198 | "raw": [":cHJldGVuZCB0aGlzIGlzIGJpbmFyeSBjb250ZW50Lg==:"], 199 | "header_type": "item", 200 | "expected": [{"__type": "binary", "value": "OBZGK5DFNZSCA5DINFZSA2LTEBRGS3TBOJ4SAY3PNZ2GK3TUFY======"}, []] 201 | }, 202 | { 203 | "name": "Example-BoolHdr", 204 | "raw": ["?1"], 205 | "header_type": "item", 206 | "expected": [true, []] 207 | } 208 | ] 209 | -------------------------------------------------------------------------------- /generate.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import base64 4 | import json 5 | 6 | ALL_CHARS = range(0x00, 0x7F + 1) 7 | WHITESPACE = [0x20] 8 | DIGITS = list(range(0x30, 0x39 + 1)) 9 | LCALPHA = list(range(0x61, 0x7A + 1)) 10 | UCALPHA = list(range(0x41, 0x5A + 1)) 11 | ALPHA = LCALPHA + UCALPHA 12 | 13 | allowed_string_chars = ( 14 | [0x20, 0x21] + list(range(0x23, 0x5B + 1)) + list(range(0x5D, 0x7E + 1)) 15 | ) 16 | escaped_string_chars = [0x22, 0x5C] 17 | allowed_token_chars = ( 18 | DIGITS 19 | + ALPHA 20 | + [ 21 | ord(c) 22 | for c in [ 23 | ":", 24 | "/", 25 | "!", 26 | "#", 27 | "$", 28 | "%", 29 | "&", 30 | "'", 31 | "*", 32 | "+", 33 | "-", 34 | ".", 35 | "^", 36 | "_", 37 | "`", 38 | "|", 39 | "~", 40 | ] 41 | ] 42 | ) 43 | allowed_token_start_chars = ALPHA + [ord("*")] 44 | allowed_key_chars = DIGITS + LCALPHA + [ord(c) for c in ["_", "-", ".", "*"]] 45 | allowed_key_start_chars = LCALPHA + [ord("*")] 46 | 47 | 48 | def write(name, data): 49 | fh = open("%s-generated.json" % name, "w") 50 | json.dump(data, fh, indent=4) 51 | fh.close() 52 | 53 | 54 | ### strings 55 | tests = [] 56 | 57 | ## allowed characters 58 | for c in ALL_CHARS: 59 | test = { 60 | "name": "0x%02x in string" % c, 61 | "raw": ['" %s "' % chr(c)], 62 | "header_type": "item", 63 | } 64 | if c in allowed_string_chars: 65 | test["expected"] = [" %s " % chr(c), []] 66 | else: 67 | test["must_fail"] = True 68 | tests.append(test) 69 | 70 | ## escaped characters 71 | for c in ALL_CHARS: 72 | test = { 73 | "name": "Escaped 0x%02x in string" % c, 74 | "raw": ['"\\%s"' % chr(c)], 75 | "header_type": "item", 76 | } 77 | if c in escaped_string_chars: 78 | test["expected"] = [chr(c), []] 79 | else: 80 | test["must_fail"] = True 81 | tests.append(test) 82 | write("string", tests) 83 | 84 | ### string serialisation failures 85 | tests = [] 86 | 87 | ## unallowed characters 88 | for c in ALL_CHARS: 89 | if c in allowed_string_chars: 90 | continue 91 | if c in escaped_string_chars: 92 | continue 93 | test = { 94 | "name": "0x%02x in string - serialise only" % c, 95 | "expected": ["%s" % chr(c), []], 96 | "header_type": "item", 97 | "must_fail": True, 98 | } 99 | tests.append(test) 100 | write("serialisation-tests/string", tests) 101 | 102 | ### tokens 103 | tests = [] 104 | 105 | ## allowed characters 106 | for c in ALL_CHARS: 107 | test = { 108 | "name": "0x%02x in token" % c, 109 | "raw": ["a%sa" % chr(c)], 110 | "header_type": "item", 111 | } 112 | if c in allowed_token_chars: 113 | test["expected"] = [{"__type": "token", "value": "a%sa" % chr(c)}, []] 114 | elif c == 0x3B: 115 | test["expected"] = [{"__type": "token", "value": "a"}, [["a", True]]] 116 | else: 117 | test["must_fail"] = True 118 | tests.append(test) 119 | 120 | ## allowed starting characters 121 | for c in ALL_CHARS: 122 | test = { 123 | "name": "0x%02x starting a token" % c, 124 | "raw": ["%sa" % chr(c)], 125 | "header_type": "item", 126 | } 127 | if c in WHITESPACE: 128 | test["expected"] = [ 129 | {"__type": "token", "value": "a"}, 130 | [], 131 | ] # whitespace is always stripped. 132 | test["canonical"] = ["a"] 133 | elif c in allowed_token_start_chars: 134 | test["expected"] = [{"__type": "token", "value": "%sa" % chr(c)}, []] 135 | else: 136 | test["must_fail"] = True 137 | tests.append(test) 138 | write("token", tests) 139 | 140 | ### token serialisation failures 141 | tests = [] 142 | 143 | ## unallowed characters 144 | for c in ALL_CHARS: 145 | if c in allowed_token_chars: 146 | continue 147 | test = { 148 | "name": "0x%02x in token - serialise only" % c, 149 | "header_type": "item", 150 | "expected": [{"__type": "token", "value": "a%sa" % chr(c)}, []], 151 | "must_fail": True, 152 | } 153 | tests.append(test) 154 | 155 | ## unallowed starting characters 156 | for c in ALL_CHARS: 157 | if c in allowed_token_start_chars: 158 | continue 159 | test = { 160 | "name": "0x%02x starting a token - serialise only" % c, 161 | "header_type": "item", 162 | "expected": [{"__type": "token", "value": "%sa" % chr(c)}, []], 163 | "must_fail": True, 164 | } 165 | tests.append(test) 166 | write("serialisation-tests/token", tests) 167 | 168 | ### keys 169 | tests = [] 170 | 171 | ## single-character dictionary keys 172 | for c in ALL_CHARS: 173 | test = { 174 | "name": "0x%02x as a single-character dictionary key" % c, 175 | "raw": ["%s=1" % chr(c)], 176 | "header_type": "dictionary", 177 | } 178 | if c in WHITESPACE: 179 | test["raw"] = ["=1"] # whitespace is always stripped. 180 | test["must_fail"] = True 181 | elif c in allowed_key_start_chars: 182 | test["expected"] = [["%s" % chr(c), [1, []]]] 183 | else: 184 | test["must_fail"] = True 185 | tests.append(test) 186 | 187 | ## dictionary keys 188 | for c in ALL_CHARS: 189 | test = { 190 | "name": "0x%02x in dictionary key" % c, 191 | "raw": ["a%sa=1" % chr(c)], 192 | "header_type": "dictionary", 193 | } 194 | if c == 0x2C: 195 | test["expected"] = [["a", [1, []]]] 196 | test["canonical"] = ["a=1"] 197 | elif c == 0x3B: 198 | test["expected"] = [["a", [True, [["a", 1]]]]] 199 | elif c in allowed_key_chars: 200 | key = "a%sa" % chr(c) 201 | test["expected"] = [[key, [1, []]]] 202 | else: 203 | test["must_fail"] = True 204 | tests.append(test) 205 | 206 | ## allowed dictionary key starting characters 207 | for c in ALL_CHARS: 208 | test = { 209 | "name": "0x%02x starting a dictionary key" % c, 210 | "raw": ["%sa=1" % chr(c)], 211 | "header_type": "dictionary", 212 | } 213 | if c in WHITESPACE: 214 | test["expected"] = [["a", [1, []]]] # whitespace is always stripped. 215 | test["canonical"] = ["a=1"] 216 | elif c in allowed_key_start_chars: 217 | test["expected"] = [["%sa" % chr(c), [1, []]]] 218 | else: 219 | test["must_fail"] = True 220 | tests.append(test) 221 | 222 | ## parameterised list keys 223 | for c in ALL_CHARS: 224 | test = { 225 | "name": "0x%02x in parameterised list key" % c, 226 | "raw": ["foo; a%sa=1" % chr(c)], 227 | "header_type": "list", 228 | } 229 | if c == 0x3B: 230 | test["expected"] = [[{"__type": "token", "value": "foo"}, [["a", 1]]]] 231 | test["canonical"] = ["foo;a=1"] 232 | elif c in allowed_key_chars: 233 | key = "a%sa" % chr(c) 234 | test["expected"] = [[{"__type": "token", "value": "foo"}, [[key, 1]]]] 235 | test["canonical"] = ["foo;a%sa=1" % chr(c)] 236 | else: 237 | test["must_fail"] = True 238 | tests.append(test) 239 | 240 | ## allowed parameterised list key starting characters 241 | for c in ALL_CHARS: 242 | test = { 243 | "name": "0x%02x starting a parameterised list key" % c, 244 | "raw": ["foo; %sa=1" % chr(c)], 245 | "header_type": "list", 246 | } 247 | if c in WHITESPACE: 248 | test["expected"] = [ 249 | [{"__type": "token", "value": "foo"}, [["a", 1]]] 250 | ] # whitespace is always stripped. 251 | test["canonical"] = ["foo;a=1"] 252 | elif c in allowed_key_start_chars: 253 | test["expected"] = [[{"__type": "token", "value": "foo"}, [["%sa" % chr(c), 1]]]] 254 | test["canonical"] = ["foo;%sa=1" % chr(c)] 255 | else: 256 | test["must_fail"] = True 257 | tests.append(test) 258 | write("key", tests) 259 | 260 | ### key serialisation failures 261 | tests = [] 262 | 263 | ## bad dictionary keys 264 | for c in ALL_CHARS: 265 | if c in allowed_key_chars: 266 | continue 267 | test = { 268 | "name": "0x%02x in dictionary key - serialise only" % c, 269 | "expected": [["a%sa" % chr(c), [1, []]]], 270 | "header_type": "dictionary", 271 | "must_fail": True, 272 | } 273 | tests.append(test) 274 | 275 | ## bad dictionary key starting characters 276 | for c in ALL_CHARS: 277 | if c in allowed_key_start_chars: 278 | continue 279 | test = { 280 | "name": "0x%02x starting a dictionary key - serialise only" % c, 281 | "header_type": "dictionary", 282 | "expected": [["%sa" % chr(c), [1, []]]], 283 | "must_fail": True, 284 | } 285 | tests.append(test) 286 | 287 | ## bad parameterised list keys 288 | for c in ALL_CHARS: 289 | if c in allowed_key_chars: 290 | continue 291 | test = { 292 | "name": "0x%02x in parameterised list key - serialise only" % c, 293 | "header_type": "list", 294 | "expected": [[{"__type": "token", "value": "foo"}, [["a%sa" % chr(c), 1]]]], 295 | "must_fail": True, 296 | } 297 | tests.append(test) 298 | 299 | # bad parameterised list key starting characters 300 | for c in ALL_CHARS: 301 | if c in allowed_key_start_chars: 302 | continue 303 | test = { 304 | "name": "0x%02x starting a parameterised list key" % c, 305 | "header_type": "list", 306 | "expected": [[{"__type": "token", "value": "foo"}, [["%sa" % chr(c), 1]]]], 307 | "must_fail": True, 308 | } 309 | tests.append(test) 310 | write("serialisation-tests/key", tests) 311 | 312 | ### large types 313 | tests = [] 314 | 315 | ## large dictionaries 316 | dict_members = 1024 317 | tests.append( 318 | { 319 | "name": "large dictionary", 320 | "raw": [", ".join(["a%s=1" % i for i in range(dict_members)])], 321 | "header_type": "dictionary", 322 | "expected": [["a%s" % i, [1, []]] for i in range(dict_members)], 323 | } 324 | ) 325 | 326 | ## large dictionary key 327 | key_length = 64 328 | tests.append( 329 | { 330 | "name": "large dictionary key", 331 | "raw": ["%s=1" % ("a" * key_length)], 332 | "header_type": "dictionary", 333 | "expected": [[("a" * key_length), [1, []]]], 334 | } 335 | ) 336 | 337 | ## large lists 338 | list_members = 1024 339 | tests.append( 340 | { 341 | "name": "large list", 342 | "raw": [", ".join(["a%s" % i for i in range(list_members)])], 343 | "header_type": "list", 344 | "expected": [ 345 | [{"__type": "token", "value": "a%s" % i}, []] for i in range(list_members) 346 | ], 347 | } 348 | ) 349 | 350 | ## large parameterised lists 351 | param_list_members = 1024 352 | tests.append( 353 | { 354 | "name": "large parameterised list", 355 | "raw": [", ".join(["foo;a%s=1" % i for i in range(param_list_members)])], 356 | "header_type": "list", 357 | "expected": [ 358 | [{"__type": "token", "value": "foo"}, [["a%s" % i, 1]]] 359 | for i in range(param_list_members) 360 | ], 361 | } 362 | ) 363 | 364 | ## large number of params 365 | param_members = 256 366 | tests.append( 367 | { 368 | "name": "large params", 369 | "raw": ["foo;%s" % ";".join(["a%s=1" % i for i in range(param_members)])], 370 | "header_type": "list", 371 | "expected": [ 372 | [ 373 | {"__type": "token", "value": "foo"}, 374 | [["a%s" % i, 1] for i in range(param_members)], 375 | ] 376 | ], 377 | } 378 | ) 379 | 380 | ## large param key 381 | tests.append( 382 | { 383 | "name": "large param key", 384 | "raw": ["foo;%s=1" % ("a" * key_length)], 385 | "header_type": "list", 386 | "expected": [[{"__type": "token", "value": "foo"}, [[("a" * key_length), 1]]]], 387 | } 388 | ) 389 | 390 | ## large strings 391 | string_length = 1024 392 | tests.append( 393 | { 394 | "name": "large string", 395 | "raw": ['"%s"' % ("=" * string_length)], 396 | "header_type": "item", 397 | "expected": ["=" * string_length, []], 398 | } 399 | ) 400 | tests.append( 401 | { 402 | "name": "large escaped string", 403 | "raw": ['"%s"' % ('\\"' * string_length)], 404 | "header_type": "item", 405 | "expected": ['"' * string_length, []], 406 | } 407 | ) 408 | 409 | ## large tokens 410 | token_length = 512 411 | tests.append( 412 | { 413 | "name": "large token", 414 | "raw": ["%s" % ("a" * token_length)], 415 | "header_type": "item", 416 | "expected": [{"__type": "token", "value": "a" * token_length}, []], 417 | } 418 | ) 419 | 420 | ## large byte sequences 421 | byte_sequence_length = 16384 422 | byte_sequence = b"a" * byte_sequence_length 423 | tests.append( 424 | { 425 | "name": "large byte sequence", 426 | "raw": [":%s:" % base64.standard_b64encode(byte_sequence).decode('ascii')], 427 | "header_type": "item", 428 | "expected": [{"__type": "binary", "value": base64.b32encode(byte_sequence).decode('ascii')}, []], 429 | } 430 | ) 431 | 432 | ## large inner lists 433 | inner_list_members = 256 434 | tests.append( 435 | { 436 | "name": "large inner list", 437 | "raw": ["(%s)" % " ".join([str(i) for i in range(inner_list_members)])], 438 | "header_type": "list", 439 | "expected": [[[[i, []] for i in range(inner_list_members)], []]], 440 | } 441 | ) 442 | 443 | 444 | write("large", tests) 445 | 446 | 447 | ## Number types 448 | tests = [] 449 | 450 | ## integer sizes 451 | number_length = 15 452 | for i in range(1, number_length + 1): 453 | tests.append( 454 | { 455 | "name": f"{i} digits of zero", 456 | "raw": ["0" * i], 457 | "header_type": "item", 458 | "expected": [0, []], 459 | "canonical": ["0"], 460 | } 461 | ) 462 | tests.append( 463 | { 464 | "name": f"{i} digit small integer", 465 | "raw": ["1" * i], 466 | "header_type": "item", 467 | "expected": [int("1" * i), []], 468 | } 469 | ) 470 | tests.append( 471 | { 472 | "name": f"{i} digit large integer", 473 | "raw": ["9" * i], 474 | "header_type": "item", 475 | "expected": [int("9" * i), []], 476 | } 477 | ) 478 | 479 | ## decimal sizes 480 | integer_length = 12 481 | fractional_length = 3 482 | for i in range(1, integer_length + 1): 483 | for j in range(1, fractional_length + 1): 484 | k = i + j 485 | tests.append( 486 | { 487 | "name": f"{k} digit 0, {j} fractional small decimal", 488 | "raw": ["0" * i + "." + "1" * j], 489 | "header_type": "item", 490 | "expected": [float("0" * i + "." + "1" * j), []], 491 | "canonical": ["0." + "1" * j], 492 | } 493 | ) 494 | tests.append( 495 | { 496 | "name": f"{k} digit, {j} fractional 0 decimal", 497 | "raw": ["1" * i + "." + "0" * j], 498 | "header_type": "item", 499 | "expected": [float("1" * i + "." + "0" * j), []], 500 | "canonical": ["1" * i + ".0"], 501 | } 502 | ) 503 | tests.append( 504 | { 505 | "name": f"{k} digit, {j} fractional small decimal", 506 | "raw": ["1" * i + "." + "1" * j], 507 | "header_type": "item", 508 | "expected": [float("1" * i + "." + "1" * j), []], 509 | } 510 | ) 511 | tests.append( 512 | { 513 | "name": f"{k} digit, {j} fractional large decimal", 514 | "raw": ["9" * i + "." + "9" * j], 515 | "header_type": "item", 516 | "expected": [float("9" * i + "." + "9" * j), []], 517 | } 518 | ) 519 | 520 | tests.append( 521 | { 522 | "name": f"too many digit 0 decimal", 523 | "raw": ["0" * (number_length) + "." + "0"], 524 | "header_type": "item", 525 | "must_fail": True, 526 | } 527 | ) 528 | tests.append( 529 | { 530 | "name": f"too many fractional digits 0 decimal", 531 | "raw": [ 532 | "0" * (number_length - fractional_length) 533 | + "." 534 | + "0" * (fractional_length + 1) 535 | ], 536 | "header_type": "item", 537 | "must_fail": True, 538 | } 539 | ) 540 | tests.append( 541 | { 542 | "name": f"too many digit 9 decimal", 543 | "raw": ["9" * (number_length) + "." + "9"], 544 | "header_type": "item", 545 | "must_fail": True, 546 | } 547 | ) 548 | tests.append( 549 | { 550 | "name": f"too many fractional digits 9 decimal", 551 | "raw": [ 552 | "9" * (number_length - fractional_length) 553 | + "." 554 | + "9" * (fractional_length + 1) 555 | ], 556 | "header_type": "item", 557 | "must_fail": True, 558 | } 559 | ) 560 | 561 | 562 | write("number", tests) 563 | -------------------------------------------------------------------------------- /item.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "empty item", 4 | "raw": [""], 5 | "header_type": "item", 6 | "must_fail": true 7 | }, 8 | { 9 | "name": "leading space", 10 | "raw": [" \t 1"], 11 | "header_type": "item", 12 | "must_fail": true 13 | }, 14 | { 15 | "name": "trailing space", 16 | "raw": ["1 \t "], 17 | "header_type": "item", 18 | "must_fail": true 19 | }, 20 | { 21 | "name": "leading and trailing space", 22 | "raw": [" 1 "], 23 | "header_type": "item", 24 | "expected": [1, []], 25 | "canonical": ["1"] 26 | }, 27 | { 28 | "name": "leading and trailing whitespace", 29 | "raw": [" 1 "], 30 | "header_type": "item", 31 | "expected": [1, []], 32 | "canonical": ["1"] 33 | } 34 | ] 35 | -------------------------------------------------------------------------------- /list.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "basic list", 4 | "raw": ["1, 42"], 5 | "header_type": "list", 6 | "expected": [[1, []], [42, []]] 7 | }, 8 | { 9 | "name": "empty list", 10 | "raw": [""], 11 | "header_type": "list", 12 | "expected": [], 13 | "canonical": [] 14 | }, 15 | { 16 | "name": "leading SP list", 17 | "raw": [" 42, 43"], 18 | "canonical": ["42, 43"], 19 | "header_type": "list", 20 | "expected": [[42, []], [43, []]] 21 | }, 22 | { 23 | "name": "single item list", 24 | "raw": ["42"], 25 | "header_type": "list", 26 | "expected": [[42, []]] 27 | }, 28 | { 29 | "name": "no whitespace list", 30 | "raw": ["1,42"], 31 | "header_type": "list", 32 | "expected": [[1, []], [42, []]], 33 | "canonical": ["1, 42"] 34 | }, 35 | { 36 | "name": "extra whitespace list", 37 | "raw": ["1 , 42"], 38 | "header_type": "list", 39 | "expected": [[1, []], [42, []]], 40 | "canonical": ["1, 42"] 41 | }, 42 | { 43 | "name": "tab separated list", 44 | "raw": ["1\t,\t42"], 45 | "header_type": "list", 46 | "expected": [[1, []], [42, []]], 47 | "canonical": ["1, 42"] 48 | }, 49 | { 50 | "name": "two line list", 51 | "raw": ["1", "42"], 52 | "header_type": "list", 53 | "expected": [[1, []], [42, []]], 54 | "canonical": ["1, 42"] 55 | }, 56 | { 57 | "name": "trailing comma list", 58 | "raw": ["1, 42,"], 59 | "header_type": "list", 60 | "must_fail": true 61 | }, 62 | { 63 | "name": "empty item list", 64 | "raw": ["1,,42"], 65 | "header_type": "list", 66 | "must_fail": true 67 | }, 68 | { 69 | "name": "empty item list (multiple field lines)", 70 | "raw": ["1","","42"], 71 | "header_type": "list", 72 | "must_fail": true 73 | } 74 | ] 75 | -------------------------------------------------------------------------------- /listlist.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "basic list of lists", 4 | "raw": ["(1 2), (42 43)"], 5 | "header_type": "list", 6 | "expected": [[[[1, []], [2, []]], []], [[[42, []], [43, []]], []]] 7 | }, 8 | { 9 | "name": "single item list of lists", 10 | "raw": ["(42)"], 11 | "header_type": "list", 12 | "expected": [[[[42, []]], []]] 13 | }, 14 | { 15 | "name": "empty item list of lists", 16 | "raw": ["()"], 17 | "header_type": "list", 18 | "expected": [[[], []]] 19 | }, 20 | { 21 | "name": "empty middle item list of lists", 22 | "raw": ["(1),(),(42)"], 23 | "header_type": "list", 24 | "expected": [[[[1, []]], []], [[], []], [[[42, []]], []]], 25 | "canonical": ["(1), (), (42)"] 26 | }, 27 | { 28 | "name": "extra whitespace list of lists", 29 | "raw": ["( 1 42 )"], 30 | "header_type": "list", 31 | "expected": [[[[1, []], [42, []]], []]], 32 | "canonical": ["(1 42)"] 33 | }, 34 | { 35 | "name": "wrong whitespace list of lists", 36 | "raw": ["(1\t 42)"], 37 | "header_type": "list", 38 | "must_fail": true 39 | }, 40 | { 41 | "name": "no trailing parenthesis list of lists", 42 | "raw": ["(1 42"], 43 | "header_type": "list", 44 | "must_fail": true 45 | }, 46 | { 47 | "name": "no trailing parenthesis middle list of lists", 48 | "raw": ["(1 2, (42 43)"], 49 | "header_type": "list", 50 | "must_fail": true 51 | }, 52 | { 53 | "name": "no spaces in inner-list", 54 | "raw": ["(abc\"def\"?0123*dXZ3*xyz)"], 55 | "header_type": "list", 56 | "must_fail": true 57 | }, 58 | { 59 | "name": "no closing parenthesis", 60 | "raw": ["("], 61 | "header_type": "list", 62 | "must_fail": true 63 | } 64 | ] 65 | -------------------------------------------------------------------------------- /number.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "basic integer", 4 | "raw": ["42"], 5 | "header_type": "item", 6 | "expected": [42, []] 7 | }, 8 | { 9 | "name": "zero integer", 10 | "raw": ["0"], 11 | "header_type": "item", 12 | "expected": [0, []] 13 | }, 14 | { 15 | "name": "negative zero", 16 | "raw": ["-0"], 17 | "header_type": "item", 18 | "expected": [0, []], 19 | "canonical": ["0"] 20 | }, 21 | { 22 | "name": "double negative zero", 23 | "raw": ["--0"], 24 | "header_type": "item", 25 | "must_fail": true 26 | }, 27 | { 28 | "name": "negative integer", 29 | "raw": ["-42"], 30 | "header_type": "item", 31 | "expected": [-42, []] 32 | }, 33 | { 34 | "name": "leading 0 integer", 35 | "raw": ["042"], 36 | "header_type": "item", 37 | "expected": [42, []], 38 | "canonical": ["42"] 39 | }, 40 | { 41 | "name": "leading 0 negative integer", 42 | "raw": ["-042"], 43 | "header_type": "item", 44 | "expected": [-42, []], 45 | "canonical": ["-42"] 46 | }, 47 | { 48 | "name": "leading 0 zero", 49 | "raw": ["00"], 50 | "header_type": "item", 51 | "expected": [0, []], 52 | "canonical": ["0"] 53 | }, 54 | { 55 | "name": "comma", 56 | "raw": ["2,3"], 57 | "header_type": "item", 58 | "must_fail": true 59 | }, 60 | { 61 | "name": "negative non-DIGIT first character", 62 | "raw": ["-a23"], 63 | "header_type": "item", 64 | "must_fail": true 65 | }, 66 | { 67 | "name": "sign out of place", 68 | "raw": ["4-2"], 69 | "header_type": "item", 70 | "must_fail": true 71 | }, 72 | { 73 | "name": "whitespace after sign", 74 | "raw": ["- 42"], 75 | "header_type": "item", 76 | "must_fail": true 77 | }, 78 | { 79 | "name": "long integer", 80 | "raw": ["123456789012345"], 81 | "header_type": "item", 82 | "expected": [123456789012345, []] 83 | }, 84 | { 85 | "name": "long negative integer", 86 | "raw": ["-123456789012345"], 87 | "header_type": "item", 88 | "expected": [-123456789012345, []] 89 | }, 90 | { 91 | "name": "too long integer", 92 | "raw": ["1234567890123456"], 93 | "header_type": "item", 94 | "must_fail": true 95 | }, 96 | { 97 | "name": "negative too long integer", 98 | "raw": ["-1234567890123456"], 99 | "header_type": "item", 100 | "must_fail": true 101 | }, 102 | { 103 | "name": "simple decimal", 104 | "raw": ["1.23"], 105 | "header_type": "item", 106 | "expected": [1.23, []] 107 | }, 108 | { 109 | "name": "negative decimal", 110 | "raw": ["-1.23"], 111 | "header_type": "item", 112 | "expected": [-1.23, []] 113 | }, 114 | { 115 | "name": "decimal, whitespace after decimal", 116 | "raw": ["1. 23"], 117 | "header_type": "item", 118 | "must_fail": true 119 | }, 120 | { 121 | "name": "decimal, whitespace before decimal", 122 | "raw": ["1 .23"], 123 | "header_type": "item", 124 | "must_fail": true 125 | }, 126 | { 127 | "name": "negative decimal, whitespace after sign", 128 | "raw": ["- 1.23"], 129 | "header_type": "item", 130 | "must_fail": true 131 | }, 132 | { 133 | "name": "tricky precision decimal", 134 | "raw": ["123456789012.1"], 135 | "header_type": "item", 136 | "expected": [123456789012.1, []] 137 | }, 138 | { 139 | "name": "double decimal decimal", 140 | "raw": ["1.5.4"], 141 | "header_type": "item", 142 | "must_fail": true 143 | }, 144 | { 145 | "name": "adjacent double decimal decimal", 146 | "raw": ["1..4"], 147 | "header_type": "item", 148 | "must_fail": true 149 | }, 150 | { 151 | "name": "decimal with three fractional digits", 152 | "raw": ["1.123"], 153 | "header_type": "item", 154 | "expected": [1.123, []] 155 | }, 156 | { 157 | "name": "negative decimal with three fractional digits", 158 | "raw": ["-1.123"], 159 | "header_type": "item", 160 | "expected": [-1.123, []] 161 | }, 162 | { 163 | "name": "decimal with four fractional digits", 164 | "raw": ["1.1234"], 165 | "header_type": "item", 166 | "must_fail": true 167 | }, 168 | { 169 | "name": "negative decimal with four fractional digits", 170 | "raw": ["-1.1234"], 171 | "header_type": "item", 172 | "must_fail": true 173 | }, 174 | { 175 | "name": "decimal with thirteen integer digits", 176 | "raw": ["1234567890123.0"], 177 | "header_type": "item", 178 | "must_fail": true 179 | }, 180 | { 181 | "name": "negative decimal with thirteen integer digits", 182 | "raw": ["-1234567890123.0"], 183 | "header_type": "item", 184 | "must_fail": true 185 | }, 186 | { 187 | "name": "decimal with 1 significant digit and 1 insignificant digit", 188 | "raw": ["1.20"], 189 | "header_type": "item", 190 | "expected": [1.2, []], 191 | "canonical": ["1.2"] 192 | }, 193 | { 194 | "name": "decimal with 1 significant digit and 2 insignificant digits", 195 | "raw": ["1.200"], 196 | "header_type": "item", 197 | "expected": [1.2, []], 198 | "canonical": ["1.2"] 199 | }, 200 | { 201 | "name": "decimal with 2 significant digits and 1 insignificant digit", 202 | "raw": ["1.230"], 203 | "header_type": "item", 204 | "expected": [1.23, []], 205 | "canonical": ["1.23"] 206 | } 207 | ] 208 | -------------------------------------------------------------------------------- /param-dict.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "basic parameterised dict", 4 | "raw": ["abc=123;a=1;b=2, def=456, ghi=789;q=9;r=\"+w\""], 5 | "header_type": "dictionary", 6 | "expected": [ 7 | ["abc", [123, [["a", 1], ["b", 2]]]], 8 | ["def", [456, []]], 9 | ["ghi", [789, [["q", 9], ["r", "+w"]]]] 10 | ] 11 | }, 12 | { 13 | "name": "single item parameterised dict", 14 | "raw": ["a=b; q=1.0"], 15 | "header_type": "dictionary", 16 | "expected": [ 17 | ["a", [{"__type": "token", "value": "b"}, [["q", 1.0]]]] 18 | ], 19 | "canonical": ["a=b;q=1.0"] 20 | }, 21 | { 22 | "name": "list item parameterised dictionary", 23 | "raw": ["a=(1 2); q=1.0"], 24 | "header_type": "dictionary", 25 | "expected": [["a", [[[1, []], [2, []]], [["q", 1.0]]]]], 26 | "canonical": ["a=(1 2);q=1.0"] 27 | }, 28 | { 29 | "name": "missing parameter value parameterised dict", 30 | "raw": ["a=3;c;d=5"], 31 | "header_type": "dictionary", 32 | "expected": [ 33 | ["a", [3, [["c", true], ["d", 5]]]] 34 | ] 35 | }, 36 | { 37 | "name": "terminal missing parameter value parameterised dict", 38 | "raw": ["a=3;c=5;d"], 39 | "header_type": "dictionary", 40 | "expected": [ 41 | ["a", [3, [["c", 5], ["d", true]]]] 42 | ] 43 | }, 44 | { 45 | "name": "no whitespace parameterised dict", 46 | "raw": ["a=b;c=1,d=e;f=2"], 47 | "header_type": "dictionary", 48 | "expected": [ 49 | ["a", [{"__type": "token", "value": "b"}, [["c", 1]]]], 50 | ["d", [{"__type": "token", "value": "e"}, [["f", 2]]]] 51 | ], 52 | "canonical": ["a=b;c=1, d=e;f=2"] 53 | }, 54 | { 55 | "name": "whitespace before = parameterised dict", 56 | "raw": ["a=b;q =0.5"], 57 | "header_type": "dictionary", 58 | "must_fail": true 59 | }, 60 | { 61 | "name": "whitespace after = parameterised dict", 62 | "raw": ["a=b;q= 0.5"], 63 | "header_type": "dictionary", 64 | "must_fail": true 65 | }, 66 | { 67 | "name": "whitespace before ; parameterised dict", 68 | "raw": ["a=b ;q=0.5"], 69 | "header_type": "dictionary", 70 | "must_fail": true 71 | }, 72 | { 73 | "name": "whitespace after ; parameterised dict", 74 | "raw": ["a=b; q=0.5"], 75 | "header_type": "dictionary", 76 | "expected": [ 77 | ["a", [{"__type": "token", "value": "b"}, [["q", 0.5]]]] 78 | ], 79 | "canonical": ["a=b;q=0.5"] 80 | }, 81 | { 82 | "name": "extra whitespace parameterised dict", 83 | "raw": ["a=b; c=1 , d=e; f=2; g=3"], 84 | "header_type": "dictionary", 85 | "expected": [ 86 | ["a", [{"__type": "token", "value": "b"}, [["c", 1]]]], 87 | ["d", [{"__type": "token", "value": "e"}, [["f", 2], ["g", 3]]]] 88 | ], 89 | "canonical": ["a=b;c=1, d=e;f=2;g=3"] 90 | }, 91 | { 92 | "name": "two lines parameterised list", 93 | "raw": ["a=b;c=1", "d=e;f=2"], 94 | "header_type": "dictionary", 95 | "expected": [ 96 | ["a", [{"__type": "token", "value": "b"}, [["c", 1]]]], 97 | ["d", [{"__type": "token", "value": "e"}, [["f", 2]]]] 98 | ], 99 | "canonical": ["a=b;c=1, d=e;f=2"] 100 | }, 101 | { 102 | "name": "trailing comma parameterised list", 103 | "raw": ["a=b; q=1.0,"], 104 | "header_type": "dictionary", 105 | "must_fail": true 106 | }, 107 | { 108 | "name": "empty item parameterised list", 109 | "raw": ["a=b; q=1.0,,c=d"], 110 | "header_type": "dictionary", 111 | "must_fail": true 112 | } 113 | ] 114 | -------------------------------------------------------------------------------- /param-list.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "basic parameterised list", 4 | "raw": ["abc_123;a=1;b=2; cdef_456, ghi;q=9;r=\"+w\""], 5 | "header_type": "list", 6 | "expected": [ 7 | [{"__type": "token", "value": "abc_123"}, [["a", 1], ["b", 2], ["cdef_456", true]]], 8 | [{"__type": "token", "value": "ghi"}, [["q", 9], ["r", "+w"]]] 9 | ], 10 | "canonical": ["abc_123;a=1;b=2;cdef_456, ghi;q=9;r=\"+w\""] 11 | }, 12 | { 13 | "name": "single item parameterised list", 14 | "raw": ["text/html;q=1.0"], 15 | "header_type": "list", 16 | "expected": [ 17 | [{"__type": "token", "value": "text/html"}, [["q", 1.0]]] 18 | ] 19 | }, 20 | { 21 | "name": "missing parameter value parameterised list", 22 | "raw": ["text/html;a;q=1.0"], 23 | "header_type": "list", 24 | "expected": [ 25 | [{"__type": "token", "value": "text/html"}, [["a", true], ["q", 1.0]]] 26 | ] 27 | }, 28 | { 29 | "name": "missing terminal parameter value parameterised list", 30 | "raw": ["text/html;q=1.0;a"], 31 | "header_type": "list", 32 | "expected": [ 33 | [{"__type": "token", "value": "text/html"}, [["q", 1.0], ["a", true]]] 34 | ] 35 | }, 36 | { 37 | "name": "no whitespace parameterised list", 38 | "raw": ["text/html,text/plain;q=0.5"], 39 | "header_type": "list", 40 | "expected": [ 41 | [{"__type": "token", "value": "text/html"}, []], 42 | [{"__type": "token", "value": "text/plain"}, [["q", 0.5]]] 43 | ], 44 | "canonical": ["text/html, text/plain;q=0.5"] 45 | }, 46 | { 47 | "name": "whitespace before = parameterised list", 48 | "raw": ["text/html, text/plain;q =0.5"], 49 | "header_type": "list", 50 | "must_fail": true 51 | }, 52 | { 53 | "name": "whitespace after = parameterised list", 54 | "raw": ["text/html, text/plain;q= 0.5"], 55 | "header_type": "list", 56 | "must_fail": true 57 | }, 58 | { 59 | "name": "whitespace before ; parameterised list", 60 | "raw": ["text/html, text/plain ;q=0.5"], 61 | "header_type": "list", 62 | "must_fail": true 63 | }, 64 | { 65 | "name": "whitespace after ; parameterised list", 66 | "raw": ["text/html, text/plain; q=0.5"], 67 | "header_type": "list", 68 | "expected": [ 69 | [{"__type": "token", "value": "text/html"}, []], 70 | [{"__type": "token", "value": "text/plain"}, [["q", 0.5]]] 71 | ], 72 | "canonical": ["text/html, text/plain;q=0.5"] 73 | }, 74 | { 75 | "name": "extra whitespace parameterised list", 76 | "raw": ["text/html , text/plain; q=0.5; charset=utf-8"], 77 | "header_type": "list", 78 | "expected": [ 79 | [{"__type": "token", "value": "text/html"}, []], 80 | [{"__type": "token", "value": "text/plain"}, 81 | [["q", 0.5], ["charset", {"__type": "token", "value": "utf-8"} 82 | ]]] 83 | ], 84 | "canonical": ["text/html, text/plain;q=0.5;charset=utf-8"] 85 | }, 86 | { 87 | "name": "two lines parameterised list", 88 | "raw": ["text/html", "text/plain;q=0.5"], 89 | "header_type": "list", 90 | "expected": [ 91 | [{"__type": "token", "value": "text/html"}, []], 92 | [{"__type": "token", "value": "text/plain"}, [["q", 0.5]]] 93 | ], 94 | "canonical": ["text/html, text/plain;q=0.5"] 95 | }, 96 | { 97 | "name": "trailing comma parameterised list", 98 | "raw": ["text/html,text/plain;q=0.5,"], 99 | "header_type": "list", 100 | "must_fail": true 101 | }, 102 | { 103 | "name": "empty item parameterised list", 104 | "raw": ["text/html,,text/plain;q=0.5,"], 105 | "header_type": "list", 106 | "must_fail": true 107 | } 108 | ] 109 | -------------------------------------------------------------------------------- /param-listlist.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "parameterised inner list", 4 | "raw": ["(abc_123);a=1;b=2, cdef_456"], 5 | "header_type": "list", 6 | "expected": [ 7 | [ 8 | [[{"__type": "token", "value": "abc_123"}, []]], 9 | [["a", 1], ["b", 2]] 10 | ], 11 | [{"__type": "token", "value": "cdef_456"}, []] 12 | ] 13 | }, 14 | { 15 | "name": "parameterised inner list item", 16 | "raw": ["(abc_123;a=1;b=2;cdef_456)"], 17 | "header_type": "list", 18 | "expected": [ 19 | [ 20 | [[{"__type": "token", "value": "abc_123"}, [["a", 1], ["b", 2], ["cdef_456", true]]]], 21 | [] 22 | ] 23 | ] 24 | }, 25 | { 26 | "name": "parameterised inner list with parameterised item", 27 | "raw": ["(abc_123;a=1;b=2);cdef_456"], 28 | "header_type": "list", 29 | "expected": [ 30 | [ 31 | [[{"__type": "token", "value": "abc_123"}, [["a", 1], ["b", 2]]]], 32 | [["cdef_456", true]] 33 | ] 34 | ] 35 | } 36 | ] 37 | -------------------------------------------------------------------------------- /schema/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | package-lock.json 3 | -------------------------------------------------------------------------------- /schema/README.md: -------------------------------------------------------------------------------- 1 | This directory contains schemas for validating the test files in `..` 2 | and `../serialisation-tests`. 3 | 4 | Validate them with: 5 | 6 | ```sh 7 | npm test 8 | ``` 9 | -------------------------------------------------------------------------------- /schema/expected.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "$id": "https://github.com/httpwg/structured-field-tests/schema/expected.schema.json", 4 | "type": "object", 5 | "required": ["header_type", "expected"], 6 | "oneOf": [ 7 | { 8 | "properties": { 9 | "header_type": { "const": "item" }, 10 | "expected": { "$ref": "#/$defs/item" } 11 | } 12 | }, 13 | { 14 | "properties": { 15 | "header_type": { "const": "list" }, 16 | "expected": { "$ref": "#/$defs/list" } 17 | } 18 | }, 19 | { 20 | "properties": { 21 | "header_type": { "const": "dictionary" }, 22 | "expected": { "$ref": "#/$defs/dictionary" } 23 | } 24 | } 25 | ], 26 | "$defs": { 27 | "bare_item": { 28 | "oneOf": [ 29 | { "type": "boolean" }, 30 | { "type": "number" }, 31 | { "type": "string" }, 32 | { 33 | "type": "object", 34 | "required": ["__type", "value"], 35 | "unevaluatedProperties": false, 36 | "oneOf": [ 37 | { 38 | "properties": { 39 | "__type": { "enum": ["binary", "displaystring", "token"] }, 40 | "value": { "type": "string" } 41 | } 42 | }, 43 | { 44 | "properties": { 45 | "__type": { "const": "date" }, 46 | "value": { "type": "number" } 47 | } 48 | } 49 | ] 50 | } 51 | ] 52 | }, 53 | "parameters": { 54 | "type": "array", 55 | "items": { 56 | "type": "array", 57 | "minItems": 2, 58 | "maxItems": 2, 59 | "prefixItems": [ 60 | { "type": "string" }, 61 | { "$ref": "#/$defs/bare_item" } 62 | ] 63 | } 64 | }, 65 | "item": { 66 | "type": "array", 67 | "minItems": 2, 68 | "maxItems": 2, 69 | "prefixItems": [ 70 | { "$ref": "#/$defs/bare_item" }, 71 | { "$ref": "#/$defs/parameters" } 72 | ] 73 | }, 74 | "inner_list": { 75 | "type": "array", 76 | "minItems": 2, 77 | "maxItems": 2, 78 | "prefixItems": [ 79 | { 80 | "type": "array", 81 | "items": { "$ref": "#/$defs/item" } 82 | }, 83 | { "$ref": "#/$defs/parameters" } 84 | ] 85 | }, 86 | "member": { 87 | "oneOf": [ 88 | { "$ref": "#/$defs/item" }, 89 | { "$ref": "#/$defs/inner_list" } 90 | ] 91 | }, 92 | "list": { 93 | "type": "array", 94 | "items": { "$ref": "#/$defs/member" } 95 | }, 96 | "dictionary": { 97 | "type": "array", 98 | "items": { 99 | "type": "array", 100 | "minItems": 2, 101 | "maxItems": 2, 102 | "prefixItems": [ 103 | { "type": "string" }, 104 | { "$ref": "#/$defs/member" } 105 | ] 106 | } 107 | } 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /schema/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "config": { 4 | "ajv_args": "--strict -r expected.schema.json" 5 | }, 6 | "scripts": { 7 | "test": "npm run validate-parse && npm run validate-serialize", 8 | "validate-parse": "ajv validate $npm_package_config_ajv_args -s parse.schema.json ../*.json", 9 | "validate-serialize": "ajv validate $npm_package_config_ajv_args -s serialize.schema.json ../serialisation-tests/*.json" 10 | }, 11 | "dependencies": { 12 | "@jirutka/ajv-cli": "^6.0.0" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /schema/parse.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "$id": "https://github.com/httpwg/structured-field-tests/schema/parse.schema.json", 4 | "type": "array", 5 | "items": { 6 | "type": "object", 7 | "properties": { 8 | "name": { "type": "string" }, 9 | "raw": { "$ref": "#/$defs/string_array" } 10 | }, 11 | "required": ["name", "raw"], 12 | "unevaluatedProperties": false, 13 | "if": { 14 | "properties": { 15 | "must_fail": { "const": true } 16 | }, 17 | "required": ["must_fail"] 18 | }, 19 | "then": { 20 | "properties": { 21 | "header_type": { "enum": ["item", "list", "dictionary"] } 22 | }, 23 | "required": ["header_type"] 24 | }, 25 | "else": { 26 | "$ref": "https://github.com/httpwg/structured-field-tests/schema/expected.schema.json", 27 | "properties": { 28 | "can_fail": { "type": "boolean" }, 29 | "canonical": { "$ref": "#/$defs/string_array" } 30 | } 31 | } 32 | }, 33 | "$defs": { 34 | "string_array": { 35 | "type": "array", 36 | "items": { "type": "string" } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /schema/serialize.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", 3 | "$id": "https://github.com/httpwg/structured-field-tests/schema/serialize.schema.json", 4 | "type": "array", 5 | "items": { 6 | "type": "object", 7 | "$ref": "https://github.com/httpwg/structured-field-tests/schema/expected.schema.json", 8 | "properties": { 9 | "name": { "type": "string" }, 10 | "must_fail": { "type": "boolean" } 11 | }, 12 | "required": ["name"], 13 | "unevaluatedProperties": false, 14 | "if": { 15 | "properties": { 16 | "must_fail": { "const": false } 17 | } 18 | }, 19 | "then": { 20 | "properties": { 21 | "canonical": { 22 | "type": "array", 23 | "items": { "type": "string" } 24 | } 25 | }, 26 | "required": ["canonical"] 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /serialisation-tests/number.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "too big positive integer - serialize", 4 | "header_type": "item", 5 | "expected": [1000000000000000, []], 6 | "must_fail": true 7 | }, 8 | { 9 | "name": "too big negative integer - serialize", 10 | "header_type": "item", 11 | "expected": [-1000000000000000, []], 12 | "must_fail": true 13 | }, 14 | { 15 | "name": "too big positive decimal - serialize", 16 | "header_type": "item", 17 | "expected": [1000000000000.1, []], 18 | "must_fail": true 19 | }, 20 | { 21 | "name": "too big negative decimal - serialize", 22 | "header_type": "item", 23 | "expected": [-1000000000000.1, []], 24 | "must_fail": true 25 | }, 26 | { 27 | "name": "round positive odd decimal - serialize", 28 | "header_type": "item", 29 | "expected": [0.0015, []], 30 | "canonical": ["0.002"] 31 | }, 32 | { 33 | "name": "round positive even decimal - serialize", 34 | "header_type": "item", 35 | "expected": [0.0025, []], 36 | "canonical": ["0.002"] 37 | }, 38 | { 39 | "name": "round negative odd decimal - serialize", 40 | "header_type": "item", 41 | "expected": [-0.0015, []], 42 | "canonical": ["-0.002"] 43 | }, 44 | { 45 | "name": "round negative even decimal - serialize", 46 | "header_type": "item", 47 | "expected": [-0.0025, []], 48 | "canonical": ["-0.002"] 49 | }, 50 | { 51 | "name": "decimal round up to integer part - serialize", 52 | "header_type": "item", 53 | "expected": [9.9995, []], 54 | "canonical": ["10.0"] 55 | } 56 | ] 57 | 58 | -------------------------------------------------------------------------------- /serialisation-tests/string-generated.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "0x00 in string - serialise only", 4 | "expected": [ 5 | "\u0000", 6 | [] 7 | ], 8 | "header_type": "item", 9 | "must_fail": true 10 | }, 11 | { 12 | "name": "0x01 in string - serialise only", 13 | "expected": [ 14 | "\u0001", 15 | [] 16 | ], 17 | "header_type": "item", 18 | "must_fail": true 19 | }, 20 | { 21 | "name": "0x02 in string - serialise only", 22 | "expected": [ 23 | "\u0002", 24 | [] 25 | ], 26 | "header_type": "item", 27 | "must_fail": true 28 | }, 29 | { 30 | "name": "0x03 in string - serialise only", 31 | "expected": [ 32 | "\u0003", 33 | [] 34 | ], 35 | "header_type": "item", 36 | "must_fail": true 37 | }, 38 | { 39 | "name": "0x04 in string - serialise only", 40 | "expected": [ 41 | "\u0004", 42 | [] 43 | ], 44 | "header_type": "item", 45 | "must_fail": true 46 | }, 47 | { 48 | "name": "0x05 in string - serialise only", 49 | "expected": [ 50 | "\u0005", 51 | [] 52 | ], 53 | "header_type": "item", 54 | "must_fail": true 55 | }, 56 | { 57 | "name": "0x06 in string - serialise only", 58 | "expected": [ 59 | "\u0006", 60 | [] 61 | ], 62 | "header_type": "item", 63 | "must_fail": true 64 | }, 65 | { 66 | "name": "0x07 in string - serialise only", 67 | "expected": [ 68 | "\u0007", 69 | [] 70 | ], 71 | "header_type": "item", 72 | "must_fail": true 73 | }, 74 | { 75 | "name": "0x08 in string - serialise only", 76 | "expected": [ 77 | "\b", 78 | [] 79 | ], 80 | "header_type": "item", 81 | "must_fail": true 82 | }, 83 | { 84 | "name": "0x09 in string - serialise only", 85 | "expected": [ 86 | "\t", 87 | [] 88 | ], 89 | "header_type": "item", 90 | "must_fail": true 91 | }, 92 | { 93 | "name": "0x0a in string - serialise only", 94 | "expected": [ 95 | "\n", 96 | [] 97 | ], 98 | "header_type": "item", 99 | "must_fail": true 100 | }, 101 | { 102 | "name": "0x0b in string - serialise only", 103 | "expected": [ 104 | "\u000b", 105 | [] 106 | ], 107 | "header_type": "item", 108 | "must_fail": true 109 | }, 110 | { 111 | "name": "0x0c in string - serialise only", 112 | "expected": [ 113 | "\f", 114 | [] 115 | ], 116 | "header_type": "item", 117 | "must_fail": true 118 | }, 119 | { 120 | "name": "0x0d in string - serialise only", 121 | "expected": [ 122 | "\r", 123 | [] 124 | ], 125 | "header_type": "item", 126 | "must_fail": true 127 | }, 128 | { 129 | "name": "0x0e in string - serialise only", 130 | "expected": [ 131 | "\u000e", 132 | [] 133 | ], 134 | "header_type": "item", 135 | "must_fail": true 136 | }, 137 | { 138 | "name": "0x0f in string - serialise only", 139 | "expected": [ 140 | "\u000f", 141 | [] 142 | ], 143 | "header_type": "item", 144 | "must_fail": true 145 | }, 146 | { 147 | "name": "0x10 in string - serialise only", 148 | "expected": [ 149 | "\u0010", 150 | [] 151 | ], 152 | "header_type": "item", 153 | "must_fail": true 154 | }, 155 | { 156 | "name": "0x11 in string - serialise only", 157 | "expected": [ 158 | "\u0011", 159 | [] 160 | ], 161 | "header_type": "item", 162 | "must_fail": true 163 | }, 164 | { 165 | "name": "0x12 in string - serialise only", 166 | "expected": [ 167 | "\u0012", 168 | [] 169 | ], 170 | "header_type": "item", 171 | "must_fail": true 172 | }, 173 | { 174 | "name": "0x13 in string - serialise only", 175 | "expected": [ 176 | "\u0013", 177 | [] 178 | ], 179 | "header_type": "item", 180 | "must_fail": true 181 | }, 182 | { 183 | "name": "0x14 in string - serialise only", 184 | "expected": [ 185 | "\u0014", 186 | [] 187 | ], 188 | "header_type": "item", 189 | "must_fail": true 190 | }, 191 | { 192 | "name": "0x15 in string - serialise only", 193 | "expected": [ 194 | "\u0015", 195 | [] 196 | ], 197 | "header_type": "item", 198 | "must_fail": true 199 | }, 200 | { 201 | "name": "0x16 in string - serialise only", 202 | "expected": [ 203 | "\u0016", 204 | [] 205 | ], 206 | "header_type": "item", 207 | "must_fail": true 208 | }, 209 | { 210 | "name": "0x17 in string - serialise only", 211 | "expected": [ 212 | "\u0017", 213 | [] 214 | ], 215 | "header_type": "item", 216 | "must_fail": true 217 | }, 218 | { 219 | "name": "0x18 in string - serialise only", 220 | "expected": [ 221 | "\u0018", 222 | [] 223 | ], 224 | "header_type": "item", 225 | "must_fail": true 226 | }, 227 | { 228 | "name": "0x19 in string - serialise only", 229 | "expected": [ 230 | "\u0019", 231 | [] 232 | ], 233 | "header_type": "item", 234 | "must_fail": true 235 | }, 236 | { 237 | "name": "0x1a in string - serialise only", 238 | "expected": [ 239 | "\u001a", 240 | [] 241 | ], 242 | "header_type": "item", 243 | "must_fail": true 244 | }, 245 | { 246 | "name": "0x1b in string - serialise only", 247 | "expected": [ 248 | "\u001b", 249 | [] 250 | ], 251 | "header_type": "item", 252 | "must_fail": true 253 | }, 254 | { 255 | "name": "0x1c in string - serialise only", 256 | "expected": [ 257 | "\u001c", 258 | [] 259 | ], 260 | "header_type": "item", 261 | "must_fail": true 262 | }, 263 | { 264 | "name": "0x1d in string - serialise only", 265 | "expected": [ 266 | "\u001d", 267 | [] 268 | ], 269 | "header_type": "item", 270 | "must_fail": true 271 | }, 272 | { 273 | "name": "0x1e in string - serialise only", 274 | "expected": [ 275 | "\u001e", 276 | [] 277 | ], 278 | "header_type": "item", 279 | "must_fail": true 280 | }, 281 | { 282 | "name": "0x1f in string - serialise only", 283 | "expected": [ 284 | "\u001f", 285 | [] 286 | ], 287 | "header_type": "item", 288 | "must_fail": true 289 | }, 290 | { 291 | "name": "0x7f in string - serialise only", 292 | "expected": [ 293 | "\u007f", 294 | [] 295 | ], 296 | "header_type": "item", 297 | "must_fail": true 298 | } 299 | ] -------------------------------------------------------------------------------- /serialisation-tests/token-generated.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "0x00 in token - serialise only", 4 | "header_type": "item", 5 | "expected": [ 6 | { 7 | "__type": "token", 8 | "value": "a\u0000a" 9 | }, 10 | [] 11 | ], 12 | "must_fail": true 13 | }, 14 | { 15 | "name": "0x01 in token - serialise only", 16 | "header_type": "item", 17 | "expected": [ 18 | { 19 | "__type": "token", 20 | "value": "a\u0001a" 21 | }, 22 | [] 23 | ], 24 | "must_fail": true 25 | }, 26 | { 27 | "name": "0x02 in token - serialise only", 28 | "header_type": "item", 29 | "expected": [ 30 | { 31 | "__type": "token", 32 | "value": "a\u0002a" 33 | }, 34 | [] 35 | ], 36 | "must_fail": true 37 | }, 38 | { 39 | "name": "0x03 in token - serialise only", 40 | "header_type": "item", 41 | "expected": [ 42 | { 43 | "__type": "token", 44 | "value": "a\u0003a" 45 | }, 46 | [] 47 | ], 48 | "must_fail": true 49 | }, 50 | { 51 | "name": "0x04 in token - serialise only", 52 | "header_type": "item", 53 | "expected": [ 54 | { 55 | "__type": "token", 56 | "value": "a\u0004a" 57 | }, 58 | [] 59 | ], 60 | "must_fail": true 61 | }, 62 | { 63 | "name": "0x05 in token - serialise only", 64 | "header_type": "item", 65 | "expected": [ 66 | { 67 | "__type": "token", 68 | "value": "a\u0005a" 69 | }, 70 | [] 71 | ], 72 | "must_fail": true 73 | }, 74 | { 75 | "name": "0x06 in token - serialise only", 76 | "header_type": "item", 77 | "expected": [ 78 | { 79 | "__type": "token", 80 | "value": "a\u0006a" 81 | }, 82 | [] 83 | ], 84 | "must_fail": true 85 | }, 86 | { 87 | "name": "0x07 in token - serialise only", 88 | "header_type": "item", 89 | "expected": [ 90 | { 91 | "__type": "token", 92 | "value": "a\u0007a" 93 | }, 94 | [] 95 | ], 96 | "must_fail": true 97 | }, 98 | { 99 | "name": "0x08 in token - serialise only", 100 | "header_type": "item", 101 | "expected": [ 102 | { 103 | "__type": "token", 104 | "value": "a\ba" 105 | }, 106 | [] 107 | ], 108 | "must_fail": true 109 | }, 110 | { 111 | "name": "0x09 in token - serialise only", 112 | "header_type": "item", 113 | "expected": [ 114 | { 115 | "__type": "token", 116 | "value": "a\ta" 117 | }, 118 | [] 119 | ], 120 | "must_fail": true 121 | }, 122 | { 123 | "name": "0x0a in token - serialise only", 124 | "header_type": "item", 125 | "expected": [ 126 | { 127 | "__type": "token", 128 | "value": "a\na" 129 | }, 130 | [] 131 | ], 132 | "must_fail": true 133 | }, 134 | { 135 | "name": "0x0b in token - serialise only", 136 | "header_type": "item", 137 | "expected": [ 138 | { 139 | "__type": "token", 140 | "value": "a\u000ba" 141 | }, 142 | [] 143 | ], 144 | "must_fail": true 145 | }, 146 | { 147 | "name": "0x0c in token - serialise only", 148 | "header_type": "item", 149 | "expected": [ 150 | { 151 | "__type": "token", 152 | "value": "a\fa" 153 | }, 154 | [] 155 | ], 156 | "must_fail": true 157 | }, 158 | { 159 | "name": "0x0d in token - serialise only", 160 | "header_type": "item", 161 | "expected": [ 162 | { 163 | "__type": "token", 164 | "value": "a\ra" 165 | }, 166 | [] 167 | ], 168 | "must_fail": true 169 | }, 170 | { 171 | "name": "0x0e in token - serialise only", 172 | "header_type": "item", 173 | "expected": [ 174 | { 175 | "__type": "token", 176 | "value": "a\u000ea" 177 | }, 178 | [] 179 | ], 180 | "must_fail": true 181 | }, 182 | { 183 | "name": "0x0f in token - serialise only", 184 | "header_type": "item", 185 | "expected": [ 186 | { 187 | "__type": "token", 188 | "value": "a\u000fa" 189 | }, 190 | [] 191 | ], 192 | "must_fail": true 193 | }, 194 | { 195 | "name": "0x10 in token - serialise only", 196 | "header_type": "item", 197 | "expected": [ 198 | { 199 | "__type": "token", 200 | "value": "a\u0010a" 201 | }, 202 | [] 203 | ], 204 | "must_fail": true 205 | }, 206 | { 207 | "name": "0x11 in token - serialise only", 208 | "header_type": "item", 209 | "expected": [ 210 | { 211 | "__type": "token", 212 | "value": "a\u0011a" 213 | }, 214 | [] 215 | ], 216 | "must_fail": true 217 | }, 218 | { 219 | "name": "0x12 in token - serialise only", 220 | "header_type": "item", 221 | "expected": [ 222 | { 223 | "__type": "token", 224 | "value": "a\u0012a" 225 | }, 226 | [] 227 | ], 228 | "must_fail": true 229 | }, 230 | { 231 | "name": "0x13 in token - serialise only", 232 | "header_type": "item", 233 | "expected": [ 234 | { 235 | "__type": "token", 236 | "value": "a\u0013a" 237 | }, 238 | [] 239 | ], 240 | "must_fail": true 241 | }, 242 | { 243 | "name": "0x14 in token - serialise only", 244 | "header_type": "item", 245 | "expected": [ 246 | { 247 | "__type": "token", 248 | "value": "a\u0014a" 249 | }, 250 | [] 251 | ], 252 | "must_fail": true 253 | }, 254 | { 255 | "name": "0x15 in token - serialise only", 256 | "header_type": "item", 257 | "expected": [ 258 | { 259 | "__type": "token", 260 | "value": "a\u0015a" 261 | }, 262 | [] 263 | ], 264 | "must_fail": true 265 | }, 266 | { 267 | "name": "0x16 in token - serialise only", 268 | "header_type": "item", 269 | "expected": [ 270 | { 271 | "__type": "token", 272 | "value": "a\u0016a" 273 | }, 274 | [] 275 | ], 276 | "must_fail": true 277 | }, 278 | { 279 | "name": "0x17 in token - serialise only", 280 | "header_type": "item", 281 | "expected": [ 282 | { 283 | "__type": "token", 284 | "value": "a\u0017a" 285 | }, 286 | [] 287 | ], 288 | "must_fail": true 289 | }, 290 | { 291 | "name": "0x18 in token - serialise only", 292 | "header_type": "item", 293 | "expected": [ 294 | { 295 | "__type": "token", 296 | "value": "a\u0018a" 297 | }, 298 | [] 299 | ], 300 | "must_fail": true 301 | }, 302 | { 303 | "name": "0x19 in token - serialise only", 304 | "header_type": "item", 305 | "expected": [ 306 | { 307 | "__type": "token", 308 | "value": "a\u0019a" 309 | }, 310 | [] 311 | ], 312 | "must_fail": true 313 | }, 314 | { 315 | "name": "0x1a in token - serialise only", 316 | "header_type": "item", 317 | "expected": [ 318 | { 319 | "__type": "token", 320 | "value": "a\u001aa" 321 | }, 322 | [] 323 | ], 324 | "must_fail": true 325 | }, 326 | { 327 | "name": "0x1b in token - serialise only", 328 | "header_type": "item", 329 | "expected": [ 330 | { 331 | "__type": "token", 332 | "value": "a\u001ba" 333 | }, 334 | [] 335 | ], 336 | "must_fail": true 337 | }, 338 | { 339 | "name": "0x1c in token - serialise only", 340 | "header_type": "item", 341 | "expected": [ 342 | { 343 | "__type": "token", 344 | "value": "a\u001ca" 345 | }, 346 | [] 347 | ], 348 | "must_fail": true 349 | }, 350 | { 351 | "name": "0x1d in token - serialise only", 352 | "header_type": "item", 353 | "expected": [ 354 | { 355 | "__type": "token", 356 | "value": "a\u001da" 357 | }, 358 | [] 359 | ], 360 | "must_fail": true 361 | }, 362 | { 363 | "name": "0x1e in token - serialise only", 364 | "header_type": "item", 365 | "expected": [ 366 | { 367 | "__type": "token", 368 | "value": "a\u001ea" 369 | }, 370 | [] 371 | ], 372 | "must_fail": true 373 | }, 374 | { 375 | "name": "0x1f in token - serialise only", 376 | "header_type": "item", 377 | "expected": [ 378 | { 379 | "__type": "token", 380 | "value": "a\u001fa" 381 | }, 382 | [] 383 | ], 384 | "must_fail": true 385 | }, 386 | { 387 | "name": "0x20 in token - serialise only", 388 | "header_type": "item", 389 | "expected": [ 390 | { 391 | "__type": "token", 392 | "value": "a a" 393 | }, 394 | [] 395 | ], 396 | "must_fail": true 397 | }, 398 | { 399 | "name": "0x22 in token - serialise only", 400 | "header_type": "item", 401 | "expected": [ 402 | { 403 | "__type": "token", 404 | "value": "a\"a" 405 | }, 406 | [] 407 | ], 408 | "must_fail": true 409 | }, 410 | { 411 | "name": "0x28 in token - serialise only", 412 | "header_type": "item", 413 | "expected": [ 414 | { 415 | "__type": "token", 416 | "value": "a(a" 417 | }, 418 | [] 419 | ], 420 | "must_fail": true 421 | }, 422 | { 423 | "name": "0x29 in token - serialise only", 424 | "header_type": "item", 425 | "expected": [ 426 | { 427 | "__type": "token", 428 | "value": "a)a" 429 | }, 430 | [] 431 | ], 432 | "must_fail": true 433 | }, 434 | { 435 | "name": "0x2c in token - serialise only", 436 | "header_type": "item", 437 | "expected": [ 438 | { 439 | "__type": "token", 440 | "value": "a,a" 441 | }, 442 | [] 443 | ], 444 | "must_fail": true 445 | }, 446 | { 447 | "name": "0x3b in token - serialise only", 448 | "header_type": "item", 449 | "expected": [ 450 | { 451 | "__type": "token", 452 | "value": "a;a" 453 | }, 454 | [] 455 | ], 456 | "must_fail": true 457 | }, 458 | { 459 | "name": "0x3c in token - serialise only", 460 | "header_type": "item", 461 | "expected": [ 462 | { 463 | "__type": "token", 464 | "value": "aa" 489 | }, 490 | [] 491 | ], 492 | "must_fail": true 493 | }, 494 | { 495 | "name": "0x3f in token - serialise only", 496 | "header_type": "item", 497 | "expected": [ 498 | { 499 | "__type": "token", 500 | "value": "a?a" 501 | }, 502 | [] 503 | ], 504 | "must_fail": true 505 | }, 506 | { 507 | "name": "0x40 in token - serialise only", 508 | "header_type": "item", 509 | "expected": [ 510 | { 511 | "__type": "token", 512 | "value": "a@a" 513 | }, 514 | [] 515 | ], 516 | "must_fail": true 517 | }, 518 | { 519 | "name": "0x5b in token - serialise only", 520 | "header_type": "item", 521 | "expected": [ 522 | { 523 | "__type": "token", 524 | "value": "a[a" 525 | }, 526 | [] 527 | ], 528 | "must_fail": true 529 | }, 530 | { 531 | "name": "0x5c in token - serialise only", 532 | "header_type": "item", 533 | "expected": [ 534 | { 535 | "__type": "token", 536 | "value": "a\\a" 537 | }, 538 | [] 539 | ], 540 | "must_fail": true 541 | }, 542 | { 543 | "name": "0x5d in token - serialise only", 544 | "header_type": "item", 545 | "expected": [ 546 | { 547 | "__type": "token", 548 | "value": "a]a" 549 | }, 550 | [] 551 | ], 552 | "must_fail": true 553 | }, 554 | { 555 | "name": "0x7b in token - serialise only", 556 | "header_type": "item", 557 | "expected": [ 558 | { 559 | "__type": "token", 560 | "value": "a{a" 561 | }, 562 | [] 563 | ], 564 | "must_fail": true 565 | }, 566 | { 567 | "name": "0x7d in token - serialise only", 568 | "header_type": "item", 569 | "expected": [ 570 | { 571 | "__type": "token", 572 | "value": "a}a" 573 | }, 574 | [] 575 | ], 576 | "must_fail": true 577 | }, 578 | { 579 | "name": "0x7f in token - serialise only", 580 | "header_type": "item", 581 | "expected": [ 582 | { 583 | "__type": "token", 584 | "value": "a\u007fa" 585 | }, 586 | [] 587 | ], 588 | "must_fail": true 589 | }, 590 | { 591 | "name": "0x00 starting a token - serialise only", 592 | "header_type": "item", 593 | "expected": [ 594 | { 595 | "__type": "token", 596 | "value": "\u0000a" 597 | }, 598 | [] 599 | ], 600 | "must_fail": true 601 | }, 602 | { 603 | "name": "0x01 starting a token - serialise only", 604 | "header_type": "item", 605 | "expected": [ 606 | { 607 | "__type": "token", 608 | "value": "\u0001a" 609 | }, 610 | [] 611 | ], 612 | "must_fail": true 613 | }, 614 | { 615 | "name": "0x02 starting a token - serialise only", 616 | "header_type": "item", 617 | "expected": [ 618 | { 619 | "__type": "token", 620 | "value": "\u0002a" 621 | }, 622 | [] 623 | ], 624 | "must_fail": true 625 | }, 626 | { 627 | "name": "0x03 starting a token - serialise only", 628 | "header_type": "item", 629 | "expected": [ 630 | { 631 | "__type": "token", 632 | "value": "\u0003a" 633 | }, 634 | [] 635 | ], 636 | "must_fail": true 637 | }, 638 | { 639 | "name": "0x04 starting a token - serialise only", 640 | "header_type": "item", 641 | "expected": [ 642 | { 643 | "__type": "token", 644 | "value": "\u0004a" 645 | }, 646 | [] 647 | ], 648 | "must_fail": true 649 | }, 650 | { 651 | "name": "0x05 starting a token - serialise only", 652 | "header_type": "item", 653 | "expected": [ 654 | { 655 | "__type": "token", 656 | "value": "\u0005a" 657 | }, 658 | [] 659 | ], 660 | "must_fail": true 661 | }, 662 | { 663 | "name": "0x06 starting a token - serialise only", 664 | "header_type": "item", 665 | "expected": [ 666 | { 667 | "__type": "token", 668 | "value": "\u0006a" 669 | }, 670 | [] 671 | ], 672 | "must_fail": true 673 | }, 674 | { 675 | "name": "0x07 starting a token - serialise only", 676 | "header_type": "item", 677 | "expected": [ 678 | { 679 | "__type": "token", 680 | "value": "\u0007a" 681 | }, 682 | [] 683 | ], 684 | "must_fail": true 685 | }, 686 | { 687 | "name": "0x08 starting a token - serialise only", 688 | "header_type": "item", 689 | "expected": [ 690 | { 691 | "__type": "token", 692 | "value": "\ba" 693 | }, 694 | [] 695 | ], 696 | "must_fail": true 697 | }, 698 | { 699 | "name": "0x09 starting a token - serialise only", 700 | "header_type": "item", 701 | "expected": [ 702 | { 703 | "__type": "token", 704 | "value": "\ta" 705 | }, 706 | [] 707 | ], 708 | "must_fail": true 709 | }, 710 | { 711 | "name": "0x0a starting a token - serialise only", 712 | "header_type": "item", 713 | "expected": [ 714 | { 715 | "__type": "token", 716 | "value": "\na" 717 | }, 718 | [] 719 | ], 720 | "must_fail": true 721 | }, 722 | { 723 | "name": "0x0b starting a token - serialise only", 724 | "header_type": "item", 725 | "expected": [ 726 | { 727 | "__type": "token", 728 | "value": "\u000ba" 729 | }, 730 | [] 731 | ], 732 | "must_fail": true 733 | }, 734 | { 735 | "name": "0x0c starting a token - serialise only", 736 | "header_type": "item", 737 | "expected": [ 738 | { 739 | "__type": "token", 740 | "value": "\fa" 741 | }, 742 | [] 743 | ], 744 | "must_fail": true 745 | }, 746 | { 747 | "name": "0x0d starting a token - serialise only", 748 | "header_type": "item", 749 | "expected": [ 750 | { 751 | "__type": "token", 752 | "value": "\ra" 753 | }, 754 | [] 755 | ], 756 | "must_fail": true 757 | }, 758 | { 759 | "name": "0x0e starting a token - serialise only", 760 | "header_type": "item", 761 | "expected": [ 762 | { 763 | "__type": "token", 764 | "value": "\u000ea" 765 | }, 766 | [] 767 | ], 768 | "must_fail": true 769 | }, 770 | { 771 | "name": "0x0f starting a token - serialise only", 772 | "header_type": "item", 773 | "expected": [ 774 | { 775 | "__type": "token", 776 | "value": "\u000fa" 777 | }, 778 | [] 779 | ], 780 | "must_fail": true 781 | }, 782 | { 783 | "name": "0x10 starting a token - serialise only", 784 | "header_type": "item", 785 | "expected": [ 786 | { 787 | "__type": "token", 788 | "value": "\u0010a" 789 | }, 790 | [] 791 | ], 792 | "must_fail": true 793 | }, 794 | { 795 | "name": "0x11 starting a token - serialise only", 796 | "header_type": "item", 797 | "expected": [ 798 | { 799 | "__type": "token", 800 | "value": "\u0011a" 801 | }, 802 | [] 803 | ], 804 | "must_fail": true 805 | }, 806 | { 807 | "name": "0x12 starting a token - serialise only", 808 | "header_type": "item", 809 | "expected": [ 810 | { 811 | "__type": "token", 812 | "value": "\u0012a" 813 | }, 814 | [] 815 | ], 816 | "must_fail": true 817 | }, 818 | { 819 | "name": "0x13 starting a token - serialise only", 820 | "header_type": "item", 821 | "expected": [ 822 | { 823 | "__type": "token", 824 | "value": "\u0013a" 825 | }, 826 | [] 827 | ], 828 | "must_fail": true 829 | }, 830 | { 831 | "name": "0x14 starting a token - serialise only", 832 | "header_type": "item", 833 | "expected": [ 834 | { 835 | "__type": "token", 836 | "value": "\u0014a" 837 | }, 838 | [] 839 | ], 840 | "must_fail": true 841 | }, 842 | { 843 | "name": "0x15 starting a token - serialise only", 844 | "header_type": "item", 845 | "expected": [ 846 | { 847 | "__type": "token", 848 | "value": "\u0015a" 849 | }, 850 | [] 851 | ], 852 | "must_fail": true 853 | }, 854 | { 855 | "name": "0x16 starting a token - serialise only", 856 | "header_type": "item", 857 | "expected": [ 858 | { 859 | "__type": "token", 860 | "value": "\u0016a" 861 | }, 862 | [] 863 | ], 864 | "must_fail": true 865 | }, 866 | { 867 | "name": "0x17 starting a token - serialise only", 868 | "header_type": "item", 869 | "expected": [ 870 | { 871 | "__type": "token", 872 | "value": "\u0017a" 873 | }, 874 | [] 875 | ], 876 | "must_fail": true 877 | }, 878 | { 879 | "name": "0x18 starting a token - serialise only", 880 | "header_type": "item", 881 | "expected": [ 882 | { 883 | "__type": "token", 884 | "value": "\u0018a" 885 | }, 886 | [] 887 | ], 888 | "must_fail": true 889 | }, 890 | { 891 | "name": "0x19 starting a token - serialise only", 892 | "header_type": "item", 893 | "expected": [ 894 | { 895 | "__type": "token", 896 | "value": "\u0019a" 897 | }, 898 | [] 899 | ], 900 | "must_fail": true 901 | }, 902 | { 903 | "name": "0x1a starting a token - serialise only", 904 | "header_type": "item", 905 | "expected": [ 906 | { 907 | "__type": "token", 908 | "value": "\u001aa" 909 | }, 910 | [] 911 | ], 912 | "must_fail": true 913 | }, 914 | { 915 | "name": "0x1b starting a token - serialise only", 916 | "header_type": "item", 917 | "expected": [ 918 | { 919 | "__type": "token", 920 | "value": "\u001ba" 921 | }, 922 | [] 923 | ], 924 | "must_fail": true 925 | }, 926 | { 927 | "name": "0x1c starting a token - serialise only", 928 | "header_type": "item", 929 | "expected": [ 930 | { 931 | "__type": "token", 932 | "value": "\u001ca" 933 | }, 934 | [] 935 | ], 936 | "must_fail": true 937 | }, 938 | { 939 | "name": "0x1d starting a token - serialise only", 940 | "header_type": "item", 941 | "expected": [ 942 | { 943 | "__type": "token", 944 | "value": "\u001da" 945 | }, 946 | [] 947 | ], 948 | "must_fail": true 949 | }, 950 | { 951 | "name": "0x1e starting a token - serialise only", 952 | "header_type": "item", 953 | "expected": [ 954 | { 955 | "__type": "token", 956 | "value": "\u001ea" 957 | }, 958 | [] 959 | ], 960 | "must_fail": true 961 | }, 962 | { 963 | "name": "0x1f starting a token - serialise only", 964 | "header_type": "item", 965 | "expected": [ 966 | { 967 | "__type": "token", 968 | "value": "\u001fa" 969 | }, 970 | [] 971 | ], 972 | "must_fail": true 973 | }, 974 | { 975 | "name": "0x20 starting a token - serialise only", 976 | "header_type": "item", 977 | "expected": [ 978 | { 979 | "__type": "token", 980 | "value": " a" 981 | }, 982 | [] 983 | ], 984 | "must_fail": true 985 | }, 986 | { 987 | "name": "0x21 starting a token - serialise only", 988 | "header_type": "item", 989 | "expected": [ 990 | { 991 | "__type": "token", 992 | "value": "!a" 993 | }, 994 | [] 995 | ], 996 | "must_fail": true 997 | }, 998 | { 999 | "name": "0x22 starting a token - serialise only", 1000 | "header_type": "item", 1001 | "expected": [ 1002 | { 1003 | "__type": "token", 1004 | "value": "\"a" 1005 | }, 1006 | [] 1007 | ], 1008 | "must_fail": true 1009 | }, 1010 | { 1011 | "name": "0x23 starting a token - serialise only", 1012 | "header_type": "item", 1013 | "expected": [ 1014 | { 1015 | "__type": "token", 1016 | "value": "#a" 1017 | }, 1018 | [] 1019 | ], 1020 | "must_fail": true 1021 | }, 1022 | { 1023 | "name": "0x24 starting a token - serialise only", 1024 | "header_type": "item", 1025 | "expected": [ 1026 | { 1027 | "__type": "token", 1028 | "value": "$a" 1029 | }, 1030 | [] 1031 | ], 1032 | "must_fail": true 1033 | }, 1034 | { 1035 | "name": "0x25 starting a token - serialise only", 1036 | "header_type": "item", 1037 | "expected": [ 1038 | { 1039 | "__type": "token", 1040 | "value": "%a" 1041 | }, 1042 | [] 1043 | ], 1044 | "must_fail": true 1045 | }, 1046 | { 1047 | "name": "0x26 starting a token - serialise only", 1048 | "header_type": "item", 1049 | "expected": [ 1050 | { 1051 | "__type": "token", 1052 | "value": "&a" 1053 | }, 1054 | [] 1055 | ], 1056 | "must_fail": true 1057 | }, 1058 | { 1059 | "name": "0x27 starting a token - serialise only", 1060 | "header_type": "item", 1061 | "expected": [ 1062 | { 1063 | "__type": "token", 1064 | "value": "'a" 1065 | }, 1066 | [] 1067 | ], 1068 | "must_fail": true 1069 | }, 1070 | { 1071 | "name": "0x28 starting a token - serialise only", 1072 | "header_type": "item", 1073 | "expected": [ 1074 | { 1075 | "__type": "token", 1076 | "value": "(a" 1077 | }, 1078 | [] 1079 | ], 1080 | "must_fail": true 1081 | }, 1082 | { 1083 | "name": "0x29 starting a token - serialise only", 1084 | "header_type": "item", 1085 | "expected": [ 1086 | { 1087 | "__type": "token", 1088 | "value": ")a" 1089 | }, 1090 | [] 1091 | ], 1092 | "must_fail": true 1093 | }, 1094 | { 1095 | "name": "0x2b starting a token - serialise only", 1096 | "header_type": "item", 1097 | "expected": [ 1098 | { 1099 | "__type": "token", 1100 | "value": "+a" 1101 | }, 1102 | [] 1103 | ], 1104 | "must_fail": true 1105 | }, 1106 | { 1107 | "name": "0x2c starting a token - serialise only", 1108 | "header_type": "item", 1109 | "expected": [ 1110 | { 1111 | "__type": "token", 1112 | "value": ",a" 1113 | }, 1114 | [] 1115 | ], 1116 | "must_fail": true 1117 | }, 1118 | { 1119 | "name": "0x2d starting a token - serialise only", 1120 | "header_type": "item", 1121 | "expected": [ 1122 | { 1123 | "__type": "token", 1124 | "value": "-a" 1125 | }, 1126 | [] 1127 | ], 1128 | "must_fail": true 1129 | }, 1130 | { 1131 | "name": "0x2e starting a token - serialise only", 1132 | "header_type": "item", 1133 | "expected": [ 1134 | { 1135 | "__type": "token", 1136 | "value": ".a" 1137 | }, 1138 | [] 1139 | ], 1140 | "must_fail": true 1141 | }, 1142 | { 1143 | "name": "0x2f starting a token - serialise only", 1144 | "header_type": "item", 1145 | "expected": [ 1146 | { 1147 | "__type": "token", 1148 | "value": "/a" 1149 | }, 1150 | [] 1151 | ], 1152 | "must_fail": true 1153 | }, 1154 | { 1155 | "name": "0x30 starting a token - serialise only", 1156 | "header_type": "item", 1157 | "expected": [ 1158 | { 1159 | "__type": "token", 1160 | "value": "0a" 1161 | }, 1162 | [] 1163 | ], 1164 | "must_fail": true 1165 | }, 1166 | { 1167 | "name": "0x31 starting a token - serialise only", 1168 | "header_type": "item", 1169 | "expected": [ 1170 | { 1171 | "__type": "token", 1172 | "value": "1a" 1173 | }, 1174 | [] 1175 | ], 1176 | "must_fail": true 1177 | }, 1178 | { 1179 | "name": "0x32 starting a token - serialise only", 1180 | "header_type": "item", 1181 | "expected": [ 1182 | { 1183 | "__type": "token", 1184 | "value": "2a" 1185 | }, 1186 | [] 1187 | ], 1188 | "must_fail": true 1189 | }, 1190 | { 1191 | "name": "0x33 starting a token - serialise only", 1192 | "header_type": "item", 1193 | "expected": [ 1194 | { 1195 | "__type": "token", 1196 | "value": "3a" 1197 | }, 1198 | [] 1199 | ], 1200 | "must_fail": true 1201 | }, 1202 | { 1203 | "name": "0x34 starting a token - serialise only", 1204 | "header_type": "item", 1205 | "expected": [ 1206 | { 1207 | "__type": "token", 1208 | "value": "4a" 1209 | }, 1210 | [] 1211 | ], 1212 | "must_fail": true 1213 | }, 1214 | { 1215 | "name": "0x35 starting a token - serialise only", 1216 | "header_type": "item", 1217 | "expected": [ 1218 | { 1219 | "__type": "token", 1220 | "value": "5a" 1221 | }, 1222 | [] 1223 | ], 1224 | "must_fail": true 1225 | }, 1226 | { 1227 | "name": "0x36 starting a token - serialise only", 1228 | "header_type": "item", 1229 | "expected": [ 1230 | { 1231 | "__type": "token", 1232 | "value": "6a" 1233 | }, 1234 | [] 1235 | ], 1236 | "must_fail": true 1237 | }, 1238 | { 1239 | "name": "0x37 starting a token - serialise only", 1240 | "header_type": "item", 1241 | "expected": [ 1242 | { 1243 | "__type": "token", 1244 | "value": "7a" 1245 | }, 1246 | [] 1247 | ], 1248 | "must_fail": true 1249 | }, 1250 | { 1251 | "name": "0x38 starting a token - serialise only", 1252 | "header_type": "item", 1253 | "expected": [ 1254 | { 1255 | "__type": "token", 1256 | "value": "8a" 1257 | }, 1258 | [] 1259 | ], 1260 | "must_fail": true 1261 | }, 1262 | { 1263 | "name": "0x39 starting a token - serialise only", 1264 | "header_type": "item", 1265 | "expected": [ 1266 | { 1267 | "__type": "token", 1268 | "value": "9a" 1269 | }, 1270 | [] 1271 | ], 1272 | "must_fail": true 1273 | }, 1274 | { 1275 | "name": "0x3a starting a token - serialise only", 1276 | "header_type": "item", 1277 | "expected": [ 1278 | { 1279 | "__type": "token", 1280 | "value": ":a" 1281 | }, 1282 | [] 1283 | ], 1284 | "must_fail": true 1285 | }, 1286 | { 1287 | "name": "0x3b starting a token - serialise only", 1288 | "header_type": "item", 1289 | "expected": [ 1290 | { 1291 | "__type": "token", 1292 | "value": ";a" 1293 | }, 1294 | [] 1295 | ], 1296 | "must_fail": true 1297 | }, 1298 | { 1299 | "name": "0x3c starting a token - serialise only", 1300 | "header_type": "item", 1301 | "expected": [ 1302 | { 1303 | "__type": "token", 1304 | "value": "a" 1329 | }, 1330 | [] 1331 | ], 1332 | "must_fail": true 1333 | }, 1334 | { 1335 | "name": "0x3f starting a token - serialise only", 1336 | "header_type": "item", 1337 | "expected": [ 1338 | { 1339 | "__type": "token", 1340 | "value": "?a" 1341 | }, 1342 | [] 1343 | ], 1344 | "must_fail": true 1345 | }, 1346 | { 1347 | "name": "0x40 starting a token - serialise only", 1348 | "header_type": "item", 1349 | "expected": [ 1350 | { 1351 | "__type": "token", 1352 | "value": "@a" 1353 | }, 1354 | [] 1355 | ], 1356 | "must_fail": true 1357 | }, 1358 | { 1359 | "name": "0x5b starting a token - serialise only", 1360 | "header_type": "item", 1361 | "expected": [ 1362 | { 1363 | "__type": "token", 1364 | "value": "[a" 1365 | }, 1366 | [] 1367 | ], 1368 | "must_fail": true 1369 | }, 1370 | { 1371 | "name": "0x5c starting a token - serialise only", 1372 | "header_type": "item", 1373 | "expected": [ 1374 | { 1375 | "__type": "token", 1376 | "value": "\\a" 1377 | }, 1378 | [] 1379 | ], 1380 | "must_fail": true 1381 | }, 1382 | { 1383 | "name": "0x5d starting a token - serialise only", 1384 | "header_type": "item", 1385 | "expected": [ 1386 | { 1387 | "__type": "token", 1388 | "value": "]a" 1389 | }, 1390 | [] 1391 | ], 1392 | "must_fail": true 1393 | }, 1394 | { 1395 | "name": "0x5e starting a token - serialise only", 1396 | "header_type": "item", 1397 | "expected": [ 1398 | { 1399 | "__type": "token", 1400 | "value": "^a" 1401 | }, 1402 | [] 1403 | ], 1404 | "must_fail": true 1405 | }, 1406 | { 1407 | "name": "0x5f starting a token - serialise only", 1408 | "header_type": "item", 1409 | "expected": [ 1410 | { 1411 | "__type": "token", 1412 | "value": "_a" 1413 | }, 1414 | [] 1415 | ], 1416 | "must_fail": true 1417 | }, 1418 | { 1419 | "name": "0x60 starting a token - serialise only", 1420 | "header_type": "item", 1421 | "expected": [ 1422 | { 1423 | "__type": "token", 1424 | "value": "`a" 1425 | }, 1426 | [] 1427 | ], 1428 | "must_fail": true 1429 | }, 1430 | { 1431 | "name": "0x7b starting a token - serialise only", 1432 | "header_type": "item", 1433 | "expected": [ 1434 | { 1435 | "__type": "token", 1436 | "value": "{a" 1437 | }, 1438 | [] 1439 | ], 1440 | "must_fail": true 1441 | }, 1442 | { 1443 | "name": "0x7c starting a token - serialise only", 1444 | "header_type": "item", 1445 | "expected": [ 1446 | { 1447 | "__type": "token", 1448 | "value": "|a" 1449 | }, 1450 | [] 1451 | ], 1452 | "must_fail": true 1453 | }, 1454 | { 1455 | "name": "0x7d starting a token - serialise only", 1456 | "header_type": "item", 1457 | "expected": [ 1458 | { 1459 | "__type": "token", 1460 | "value": "}a" 1461 | }, 1462 | [] 1463 | ], 1464 | "must_fail": true 1465 | }, 1466 | { 1467 | "name": "0x7e starting a token - serialise only", 1468 | "header_type": "item", 1469 | "expected": [ 1470 | { 1471 | "__type": "token", 1472 | "value": "~a" 1473 | }, 1474 | [] 1475 | ], 1476 | "must_fail": true 1477 | }, 1478 | { 1479 | "name": "0x7f starting a token - serialise only", 1480 | "header_type": "item", 1481 | "expected": [ 1482 | { 1483 | "__type": "token", 1484 | "value": "\u007fa" 1485 | }, 1486 | [] 1487 | ], 1488 | "must_fail": true 1489 | } 1490 | ] -------------------------------------------------------------------------------- /string-generated.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "0x00 in string", 4 | "raw": [ 5 | "\" \u0000 \"" 6 | ], 7 | "header_type": "item", 8 | "must_fail": true 9 | }, 10 | { 11 | "name": "0x01 in string", 12 | "raw": [ 13 | "\" \u0001 \"" 14 | ], 15 | "header_type": "item", 16 | "must_fail": true 17 | }, 18 | { 19 | "name": "0x02 in string", 20 | "raw": [ 21 | "\" \u0002 \"" 22 | ], 23 | "header_type": "item", 24 | "must_fail": true 25 | }, 26 | { 27 | "name": "0x03 in string", 28 | "raw": [ 29 | "\" \u0003 \"" 30 | ], 31 | "header_type": "item", 32 | "must_fail": true 33 | }, 34 | { 35 | "name": "0x04 in string", 36 | "raw": [ 37 | "\" \u0004 \"" 38 | ], 39 | "header_type": "item", 40 | "must_fail": true 41 | }, 42 | { 43 | "name": "0x05 in string", 44 | "raw": [ 45 | "\" \u0005 \"" 46 | ], 47 | "header_type": "item", 48 | "must_fail": true 49 | }, 50 | { 51 | "name": "0x06 in string", 52 | "raw": [ 53 | "\" \u0006 \"" 54 | ], 55 | "header_type": "item", 56 | "must_fail": true 57 | }, 58 | { 59 | "name": "0x07 in string", 60 | "raw": [ 61 | "\" \u0007 \"" 62 | ], 63 | "header_type": "item", 64 | "must_fail": true 65 | }, 66 | { 67 | "name": "0x08 in string", 68 | "raw": [ 69 | "\" \b \"" 70 | ], 71 | "header_type": "item", 72 | "must_fail": true 73 | }, 74 | { 75 | "name": "0x09 in string", 76 | "raw": [ 77 | "\" \t \"" 78 | ], 79 | "header_type": "item", 80 | "must_fail": true 81 | }, 82 | { 83 | "name": "0x0a in string", 84 | "raw": [ 85 | "\" \n \"" 86 | ], 87 | "header_type": "item", 88 | "must_fail": true 89 | }, 90 | { 91 | "name": "0x0b in string", 92 | "raw": [ 93 | "\" \u000b \"" 94 | ], 95 | "header_type": "item", 96 | "must_fail": true 97 | }, 98 | { 99 | "name": "0x0c in string", 100 | "raw": [ 101 | "\" \f \"" 102 | ], 103 | "header_type": "item", 104 | "must_fail": true 105 | }, 106 | { 107 | "name": "0x0d in string", 108 | "raw": [ 109 | "\" \r \"" 110 | ], 111 | "header_type": "item", 112 | "must_fail": true 113 | }, 114 | { 115 | "name": "0x0e in string", 116 | "raw": [ 117 | "\" \u000e \"" 118 | ], 119 | "header_type": "item", 120 | "must_fail": true 121 | }, 122 | { 123 | "name": "0x0f in string", 124 | "raw": [ 125 | "\" \u000f \"" 126 | ], 127 | "header_type": "item", 128 | "must_fail": true 129 | }, 130 | { 131 | "name": "0x10 in string", 132 | "raw": [ 133 | "\" \u0010 \"" 134 | ], 135 | "header_type": "item", 136 | "must_fail": true 137 | }, 138 | { 139 | "name": "0x11 in string", 140 | "raw": [ 141 | "\" \u0011 \"" 142 | ], 143 | "header_type": "item", 144 | "must_fail": true 145 | }, 146 | { 147 | "name": "0x12 in string", 148 | "raw": [ 149 | "\" \u0012 \"" 150 | ], 151 | "header_type": "item", 152 | "must_fail": true 153 | }, 154 | { 155 | "name": "0x13 in string", 156 | "raw": [ 157 | "\" \u0013 \"" 158 | ], 159 | "header_type": "item", 160 | "must_fail": true 161 | }, 162 | { 163 | "name": "0x14 in string", 164 | "raw": [ 165 | "\" \u0014 \"" 166 | ], 167 | "header_type": "item", 168 | "must_fail": true 169 | }, 170 | { 171 | "name": "0x15 in string", 172 | "raw": [ 173 | "\" \u0015 \"" 174 | ], 175 | "header_type": "item", 176 | "must_fail": true 177 | }, 178 | { 179 | "name": "0x16 in string", 180 | "raw": [ 181 | "\" \u0016 \"" 182 | ], 183 | "header_type": "item", 184 | "must_fail": true 185 | }, 186 | { 187 | "name": "0x17 in string", 188 | "raw": [ 189 | "\" \u0017 \"" 190 | ], 191 | "header_type": "item", 192 | "must_fail": true 193 | }, 194 | { 195 | "name": "0x18 in string", 196 | "raw": [ 197 | "\" \u0018 \"" 198 | ], 199 | "header_type": "item", 200 | "must_fail": true 201 | }, 202 | { 203 | "name": "0x19 in string", 204 | "raw": [ 205 | "\" \u0019 \"" 206 | ], 207 | "header_type": "item", 208 | "must_fail": true 209 | }, 210 | { 211 | "name": "0x1a in string", 212 | "raw": [ 213 | "\" \u001a \"" 214 | ], 215 | "header_type": "item", 216 | "must_fail": true 217 | }, 218 | { 219 | "name": "0x1b in string", 220 | "raw": [ 221 | "\" \u001b \"" 222 | ], 223 | "header_type": "item", 224 | "must_fail": true 225 | }, 226 | { 227 | "name": "0x1c in string", 228 | "raw": [ 229 | "\" \u001c \"" 230 | ], 231 | "header_type": "item", 232 | "must_fail": true 233 | }, 234 | { 235 | "name": "0x1d in string", 236 | "raw": [ 237 | "\" \u001d \"" 238 | ], 239 | "header_type": "item", 240 | "must_fail": true 241 | }, 242 | { 243 | "name": "0x1e in string", 244 | "raw": [ 245 | "\" \u001e \"" 246 | ], 247 | "header_type": "item", 248 | "must_fail": true 249 | }, 250 | { 251 | "name": "0x1f in string", 252 | "raw": [ 253 | "\" \u001f \"" 254 | ], 255 | "header_type": "item", 256 | "must_fail": true 257 | }, 258 | { 259 | "name": "0x20 in string", 260 | "raw": [ 261 | "\" \"" 262 | ], 263 | "header_type": "item", 264 | "expected": [ 265 | " ", 266 | [] 267 | ] 268 | }, 269 | { 270 | "name": "0x21 in string", 271 | "raw": [ 272 | "\" ! \"" 273 | ], 274 | "header_type": "item", 275 | "expected": [ 276 | " ! ", 277 | [] 278 | ] 279 | }, 280 | { 281 | "name": "0x22 in string", 282 | "raw": [ 283 | "\" \" \"" 284 | ], 285 | "header_type": "item", 286 | "must_fail": true 287 | }, 288 | { 289 | "name": "0x23 in string", 290 | "raw": [ 291 | "\" # \"" 292 | ], 293 | "header_type": "item", 294 | "expected": [ 295 | " # ", 296 | [] 297 | ] 298 | }, 299 | { 300 | "name": "0x24 in string", 301 | "raw": [ 302 | "\" $ \"" 303 | ], 304 | "header_type": "item", 305 | "expected": [ 306 | " $ ", 307 | [] 308 | ] 309 | }, 310 | { 311 | "name": "0x25 in string", 312 | "raw": [ 313 | "\" % \"" 314 | ], 315 | "header_type": "item", 316 | "expected": [ 317 | " % ", 318 | [] 319 | ] 320 | }, 321 | { 322 | "name": "0x26 in string", 323 | "raw": [ 324 | "\" & \"" 325 | ], 326 | "header_type": "item", 327 | "expected": [ 328 | " & ", 329 | [] 330 | ] 331 | }, 332 | { 333 | "name": "0x27 in string", 334 | "raw": [ 335 | "\" ' \"" 336 | ], 337 | "header_type": "item", 338 | "expected": [ 339 | " ' ", 340 | [] 341 | ] 342 | }, 343 | { 344 | "name": "0x28 in string", 345 | "raw": [ 346 | "\" ( \"" 347 | ], 348 | "header_type": "item", 349 | "expected": [ 350 | " ( ", 351 | [] 352 | ] 353 | }, 354 | { 355 | "name": "0x29 in string", 356 | "raw": [ 357 | "\" ) \"" 358 | ], 359 | "header_type": "item", 360 | "expected": [ 361 | " ) ", 362 | [] 363 | ] 364 | }, 365 | { 366 | "name": "0x2a in string", 367 | "raw": [ 368 | "\" * \"" 369 | ], 370 | "header_type": "item", 371 | "expected": [ 372 | " * ", 373 | [] 374 | ] 375 | }, 376 | { 377 | "name": "0x2b in string", 378 | "raw": [ 379 | "\" + \"" 380 | ], 381 | "header_type": "item", 382 | "expected": [ 383 | " + ", 384 | [] 385 | ] 386 | }, 387 | { 388 | "name": "0x2c in string", 389 | "raw": [ 390 | "\" , \"" 391 | ], 392 | "header_type": "item", 393 | "expected": [ 394 | " , ", 395 | [] 396 | ] 397 | }, 398 | { 399 | "name": "0x2d in string", 400 | "raw": [ 401 | "\" - \"" 402 | ], 403 | "header_type": "item", 404 | "expected": [ 405 | " - ", 406 | [] 407 | ] 408 | }, 409 | { 410 | "name": "0x2e in string", 411 | "raw": [ 412 | "\" . \"" 413 | ], 414 | "header_type": "item", 415 | "expected": [ 416 | " . ", 417 | [] 418 | ] 419 | }, 420 | { 421 | "name": "0x2f in string", 422 | "raw": [ 423 | "\" / \"" 424 | ], 425 | "header_type": "item", 426 | "expected": [ 427 | " / ", 428 | [] 429 | ] 430 | }, 431 | { 432 | "name": "0x30 in string", 433 | "raw": [ 434 | "\" 0 \"" 435 | ], 436 | "header_type": "item", 437 | "expected": [ 438 | " 0 ", 439 | [] 440 | ] 441 | }, 442 | { 443 | "name": "0x31 in string", 444 | "raw": [ 445 | "\" 1 \"" 446 | ], 447 | "header_type": "item", 448 | "expected": [ 449 | " 1 ", 450 | [] 451 | ] 452 | }, 453 | { 454 | "name": "0x32 in string", 455 | "raw": [ 456 | "\" 2 \"" 457 | ], 458 | "header_type": "item", 459 | "expected": [ 460 | " 2 ", 461 | [] 462 | ] 463 | }, 464 | { 465 | "name": "0x33 in string", 466 | "raw": [ 467 | "\" 3 \"" 468 | ], 469 | "header_type": "item", 470 | "expected": [ 471 | " 3 ", 472 | [] 473 | ] 474 | }, 475 | { 476 | "name": "0x34 in string", 477 | "raw": [ 478 | "\" 4 \"" 479 | ], 480 | "header_type": "item", 481 | "expected": [ 482 | " 4 ", 483 | [] 484 | ] 485 | }, 486 | { 487 | "name": "0x35 in string", 488 | "raw": [ 489 | "\" 5 \"" 490 | ], 491 | "header_type": "item", 492 | "expected": [ 493 | " 5 ", 494 | [] 495 | ] 496 | }, 497 | { 498 | "name": "0x36 in string", 499 | "raw": [ 500 | "\" 6 \"" 501 | ], 502 | "header_type": "item", 503 | "expected": [ 504 | " 6 ", 505 | [] 506 | ] 507 | }, 508 | { 509 | "name": "0x37 in string", 510 | "raw": [ 511 | "\" 7 \"" 512 | ], 513 | "header_type": "item", 514 | "expected": [ 515 | " 7 ", 516 | [] 517 | ] 518 | }, 519 | { 520 | "name": "0x38 in string", 521 | "raw": [ 522 | "\" 8 \"" 523 | ], 524 | "header_type": "item", 525 | "expected": [ 526 | " 8 ", 527 | [] 528 | ] 529 | }, 530 | { 531 | "name": "0x39 in string", 532 | "raw": [ 533 | "\" 9 \"" 534 | ], 535 | "header_type": "item", 536 | "expected": [ 537 | " 9 ", 538 | [] 539 | ] 540 | }, 541 | { 542 | "name": "0x3a in string", 543 | "raw": [ 544 | "\" : \"" 545 | ], 546 | "header_type": "item", 547 | "expected": [ 548 | " : ", 549 | [] 550 | ] 551 | }, 552 | { 553 | "name": "0x3b in string", 554 | "raw": [ 555 | "\" ; \"" 556 | ], 557 | "header_type": "item", 558 | "expected": [ 559 | " ; ", 560 | [] 561 | ] 562 | }, 563 | { 564 | "name": "0x3c in string", 565 | "raw": [ 566 | "\" < \"" 567 | ], 568 | "header_type": "item", 569 | "expected": [ 570 | " < ", 571 | [] 572 | ] 573 | }, 574 | { 575 | "name": "0x3d in string", 576 | "raw": [ 577 | "\" = \"" 578 | ], 579 | "header_type": "item", 580 | "expected": [ 581 | " = ", 582 | [] 583 | ] 584 | }, 585 | { 586 | "name": "0x3e in string", 587 | "raw": [ 588 | "\" > \"" 589 | ], 590 | "header_type": "item", 591 | "expected": [ 592 | " > ", 593 | [] 594 | ] 595 | }, 596 | { 597 | "name": "0x3f in string", 598 | "raw": [ 599 | "\" ? \"" 600 | ], 601 | "header_type": "item", 602 | "expected": [ 603 | " ? ", 604 | [] 605 | ] 606 | }, 607 | { 608 | "name": "0x40 in string", 609 | "raw": [ 610 | "\" @ \"" 611 | ], 612 | "header_type": "item", 613 | "expected": [ 614 | " @ ", 615 | [] 616 | ] 617 | }, 618 | { 619 | "name": "0x41 in string", 620 | "raw": [ 621 | "\" A \"" 622 | ], 623 | "header_type": "item", 624 | "expected": [ 625 | " A ", 626 | [] 627 | ] 628 | }, 629 | { 630 | "name": "0x42 in string", 631 | "raw": [ 632 | "\" B \"" 633 | ], 634 | "header_type": "item", 635 | "expected": [ 636 | " B ", 637 | [] 638 | ] 639 | }, 640 | { 641 | "name": "0x43 in string", 642 | "raw": [ 643 | "\" C \"" 644 | ], 645 | "header_type": "item", 646 | "expected": [ 647 | " C ", 648 | [] 649 | ] 650 | }, 651 | { 652 | "name": "0x44 in string", 653 | "raw": [ 654 | "\" D \"" 655 | ], 656 | "header_type": "item", 657 | "expected": [ 658 | " D ", 659 | [] 660 | ] 661 | }, 662 | { 663 | "name": "0x45 in string", 664 | "raw": [ 665 | "\" E \"" 666 | ], 667 | "header_type": "item", 668 | "expected": [ 669 | " E ", 670 | [] 671 | ] 672 | }, 673 | { 674 | "name": "0x46 in string", 675 | "raw": [ 676 | "\" F \"" 677 | ], 678 | "header_type": "item", 679 | "expected": [ 680 | " F ", 681 | [] 682 | ] 683 | }, 684 | { 685 | "name": "0x47 in string", 686 | "raw": [ 687 | "\" G \"" 688 | ], 689 | "header_type": "item", 690 | "expected": [ 691 | " G ", 692 | [] 693 | ] 694 | }, 695 | { 696 | "name": "0x48 in string", 697 | "raw": [ 698 | "\" H \"" 699 | ], 700 | "header_type": "item", 701 | "expected": [ 702 | " H ", 703 | [] 704 | ] 705 | }, 706 | { 707 | "name": "0x49 in string", 708 | "raw": [ 709 | "\" I \"" 710 | ], 711 | "header_type": "item", 712 | "expected": [ 713 | " I ", 714 | [] 715 | ] 716 | }, 717 | { 718 | "name": "0x4a in string", 719 | "raw": [ 720 | "\" J \"" 721 | ], 722 | "header_type": "item", 723 | "expected": [ 724 | " J ", 725 | [] 726 | ] 727 | }, 728 | { 729 | "name": "0x4b in string", 730 | "raw": [ 731 | "\" K \"" 732 | ], 733 | "header_type": "item", 734 | "expected": [ 735 | " K ", 736 | [] 737 | ] 738 | }, 739 | { 740 | "name": "0x4c in string", 741 | "raw": [ 742 | "\" L \"" 743 | ], 744 | "header_type": "item", 745 | "expected": [ 746 | " L ", 747 | [] 748 | ] 749 | }, 750 | { 751 | "name": "0x4d in string", 752 | "raw": [ 753 | "\" M \"" 754 | ], 755 | "header_type": "item", 756 | "expected": [ 757 | " M ", 758 | [] 759 | ] 760 | }, 761 | { 762 | "name": "0x4e in string", 763 | "raw": [ 764 | "\" N \"" 765 | ], 766 | "header_type": "item", 767 | "expected": [ 768 | " N ", 769 | [] 770 | ] 771 | }, 772 | { 773 | "name": "0x4f in string", 774 | "raw": [ 775 | "\" O \"" 776 | ], 777 | "header_type": "item", 778 | "expected": [ 779 | " O ", 780 | [] 781 | ] 782 | }, 783 | { 784 | "name": "0x50 in string", 785 | "raw": [ 786 | "\" P \"" 787 | ], 788 | "header_type": "item", 789 | "expected": [ 790 | " P ", 791 | [] 792 | ] 793 | }, 794 | { 795 | "name": "0x51 in string", 796 | "raw": [ 797 | "\" Q \"" 798 | ], 799 | "header_type": "item", 800 | "expected": [ 801 | " Q ", 802 | [] 803 | ] 804 | }, 805 | { 806 | "name": "0x52 in string", 807 | "raw": [ 808 | "\" R \"" 809 | ], 810 | "header_type": "item", 811 | "expected": [ 812 | " R ", 813 | [] 814 | ] 815 | }, 816 | { 817 | "name": "0x53 in string", 818 | "raw": [ 819 | "\" S \"" 820 | ], 821 | "header_type": "item", 822 | "expected": [ 823 | " S ", 824 | [] 825 | ] 826 | }, 827 | { 828 | "name": "0x54 in string", 829 | "raw": [ 830 | "\" T \"" 831 | ], 832 | "header_type": "item", 833 | "expected": [ 834 | " T ", 835 | [] 836 | ] 837 | }, 838 | { 839 | "name": "0x55 in string", 840 | "raw": [ 841 | "\" U \"" 842 | ], 843 | "header_type": "item", 844 | "expected": [ 845 | " U ", 846 | [] 847 | ] 848 | }, 849 | { 850 | "name": "0x56 in string", 851 | "raw": [ 852 | "\" V \"" 853 | ], 854 | "header_type": "item", 855 | "expected": [ 856 | " V ", 857 | [] 858 | ] 859 | }, 860 | { 861 | "name": "0x57 in string", 862 | "raw": [ 863 | "\" W \"" 864 | ], 865 | "header_type": "item", 866 | "expected": [ 867 | " W ", 868 | [] 869 | ] 870 | }, 871 | { 872 | "name": "0x58 in string", 873 | "raw": [ 874 | "\" X \"" 875 | ], 876 | "header_type": "item", 877 | "expected": [ 878 | " X ", 879 | [] 880 | ] 881 | }, 882 | { 883 | "name": "0x59 in string", 884 | "raw": [ 885 | "\" Y \"" 886 | ], 887 | "header_type": "item", 888 | "expected": [ 889 | " Y ", 890 | [] 891 | ] 892 | }, 893 | { 894 | "name": "0x5a in string", 895 | "raw": [ 896 | "\" Z \"" 897 | ], 898 | "header_type": "item", 899 | "expected": [ 900 | " Z ", 901 | [] 902 | ] 903 | }, 904 | { 905 | "name": "0x5b in string", 906 | "raw": [ 907 | "\" [ \"" 908 | ], 909 | "header_type": "item", 910 | "expected": [ 911 | " [ ", 912 | [] 913 | ] 914 | }, 915 | { 916 | "name": "0x5c in string", 917 | "raw": [ 918 | "\" \\ \"" 919 | ], 920 | "header_type": "item", 921 | "must_fail": true 922 | }, 923 | { 924 | "name": "0x5d in string", 925 | "raw": [ 926 | "\" ] \"" 927 | ], 928 | "header_type": "item", 929 | "expected": [ 930 | " ] ", 931 | [] 932 | ] 933 | }, 934 | { 935 | "name": "0x5e in string", 936 | "raw": [ 937 | "\" ^ \"" 938 | ], 939 | "header_type": "item", 940 | "expected": [ 941 | " ^ ", 942 | [] 943 | ] 944 | }, 945 | { 946 | "name": "0x5f in string", 947 | "raw": [ 948 | "\" _ \"" 949 | ], 950 | "header_type": "item", 951 | "expected": [ 952 | " _ ", 953 | [] 954 | ] 955 | }, 956 | { 957 | "name": "0x60 in string", 958 | "raw": [ 959 | "\" ` \"" 960 | ], 961 | "header_type": "item", 962 | "expected": [ 963 | " ` ", 964 | [] 965 | ] 966 | }, 967 | { 968 | "name": "0x61 in string", 969 | "raw": [ 970 | "\" a \"" 971 | ], 972 | "header_type": "item", 973 | "expected": [ 974 | " a ", 975 | [] 976 | ] 977 | }, 978 | { 979 | "name": "0x62 in string", 980 | "raw": [ 981 | "\" b \"" 982 | ], 983 | "header_type": "item", 984 | "expected": [ 985 | " b ", 986 | [] 987 | ] 988 | }, 989 | { 990 | "name": "0x63 in string", 991 | "raw": [ 992 | "\" c \"" 993 | ], 994 | "header_type": "item", 995 | "expected": [ 996 | " c ", 997 | [] 998 | ] 999 | }, 1000 | { 1001 | "name": "0x64 in string", 1002 | "raw": [ 1003 | "\" d \"" 1004 | ], 1005 | "header_type": "item", 1006 | "expected": [ 1007 | " d ", 1008 | [] 1009 | ] 1010 | }, 1011 | { 1012 | "name": "0x65 in string", 1013 | "raw": [ 1014 | "\" e \"" 1015 | ], 1016 | "header_type": "item", 1017 | "expected": [ 1018 | " e ", 1019 | [] 1020 | ] 1021 | }, 1022 | { 1023 | "name": "0x66 in string", 1024 | "raw": [ 1025 | "\" f \"" 1026 | ], 1027 | "header_type": "item", 1028 | "expected": [ 1029 | " f ", 1030 | [] 1031 | ] 1032 | }, 1033 | { 1034 | "name": "0x67 in string", 1035 | "raw": [ 1036 | "\" g \"" 1037 | ], 1038 | "header_type": "item", 1039 | "expected": [ 1040 | " g ", 1041 | [] 1042 | ] 1043 | }, 1044 | { 1045 | "name": "0x68 in string", 1046 | "raw": [ 1047 | "\" h \"" 1048 | ], 1049 | "header_type": "item", 1050 | "expected": [ 1051 | " h ", 1052 | [] 1053 | ] 1054 | }, 1055 | { 1056 | "name": "0x69 in string", 1057 | "raw": [ 1058 | "\" i \"" 1059 | ], 1060 | "header_type": "item", 1061 | "expected": [ 1062 | " i ", 1063 | [] 1064 | ] 1065 | }, 1066 | { 1067 | "name": "0x6a in string", 1068 | "raw": [ 1069 | "\" j \"" 1070 | ], 1071 | "header_type": "item", 1072 | "expected": [ 1073 | " j ", 1074 | [] 1075 | ] 1076 | }, 1077 | { 1078 | "name": "0x6b in string", 1079 | "raw": [ 1080 | "\" k \"" 1081 | ], 1082 | "header_type": "item", 1083 | "expected": [ 1084 | " k ", 1085 | [] 1086 | ] 1087 | }, 1088 | { 1089 | "name": "0x6c in string", 1090 | "raw": [ 1091 | "\" l \"" 1092 | ], 1093 | "header_type": "item", 1094 | "expected": [ 1095 | " l ", 1096 | [] 1097 | ] 1098 | }, 1099 | { 1100 | "name": "0x6d in string", 1101 | "raw": [ 1102 | "\" m \"" 1103 | ], 1104 | "header_type": "item", 1105 | "expected": [ 1106 | " m ", 1107 | [] 1108 | ] 1109 | }, 1110 | { 1111 | "name": "0x6e in string", 1112 | "raw": [ 1113 | "\" n \"" 1114 | ], 1115 | "header_type": "item", 1116 | "expected": [ 1117 | " n ", 1118 | [] 1119 | ] 1120 | }, 1121 | { 1122 | "name": "0x6f in string", 1123 | "raw": [ 1124 | "\" o \"" 1125 | ], 1126 | "header_type": "item", 1127 | "expected": [ 1128 | " o ", 1129 | [] 1130 | ] 1131 | }, 1132 | { 1133 | "name": "0x70 in string", 1134 | "raw": [ 1135 | "\" p \"" 1136 | ], 1137 | "header_type": "item", 1138 | "expected": [ 1139 | " p ", 1140 | [] 1141 | ] 1142 | }, 1143 | { 1144 | "name": "0x71 in string", 1145 | "raw": [ 1146 | "\" q \"" 1147 | ], 1148 | "header_type": "item", 1149 | "expected": [ 1150 | " q ", 1151 | [] 1152 | ] 1153 | }, 1154 | { 1155 | "name": "0x72 in string", 1156 | "raw": [ 1157 | "\" r \"" 1158 | ], 1159 | "header_type": "item", 1160 | "expected": [ 1161 | " r ", 1162 | [] 1163 | ] 1164 | }, 1165 | { 1166 | "name": "0x73 in string", 1167 | "raw": [ 1168 | "\" s \"" 1169 | ], 1170 | "header_type": "item", 1171 | "expected": [ 1172 | " s ", 1173 | [] 1174 | ] 1175 | }, 1176 | { 1177 | "name": "0x74 in string", 1178 | "raw": [ 1179 | "\" t \"" 1180 | ], 1181 | "header_type": "item", 1182 | "expected": [ 1183 | " t ", 1184 | [] 1185 | ] 1186 | }, 1187 | { 1188 | "name": "0x75 in string", 1189 | "raw": [ 1190 | "\" u \"" 1191 | ], 1192 | "header_type": "item", 1193 | "expected": [ 1194 | " u ", 1195 | [] 1196 | ] 1197 | }, 1198 | { 1199 | "name": "0x76 in string", 1200 | "raw": [ 1201 | "\" v \"" 1202 | ], 1203 | "header_type": "item", 1204 | "expected": [ 1205 | " v ", 1206 | [] 1207 | ] 1208 | }, 1209 | { 1210 | "name": "0x77 in string", 1211 | "raw": [ 1212 | "\" w \"" 1213 | ], 1214 | "header_type": "item", 1215 | "expected": [ 1216 | " w ", 1217 | [] 1218 | ] 1219 | }, 1220 | { 1221 | "name": "0x78 in string", 1222 | "raw": [ 1223 | "\" x \"" 1224 | ], 1225 | "header_type": "item", 1226 | "expected": [ 1227 | " x ", 1228 | [] 1229 | ] 1230 | }, 1231 | { 1232 | "name": "0x79 in string", 1233 | "raw": [ 1234 | "\" y \"" 1235 | ], 1236 | "header_type": "item", 1237 | "expected": [ 1238 | " y ", 1239 | [] 1240 | ] 1241 | }, 1242 | { 1243 | "name": "0x7a in string", 1244 | "raw": [ 1245 | "\" z \"" 1246 | ], 1247 | "header_type": "item", 1248 | "expected": [ 1249 | " z ", 1250 | [] 1251 | ] 1252 | }, 1253 | { 1254 | "name": "0x7b in string", 1255 | "raw": [ 1256 | "\" { \"" 1257 | ], 1258 | "header_type": "item", 1259 | "expected": [ 1260 | " { ", 1261 | [] 1262 | ] 1263 | }, 1264 | { 1265 | "name": "0x7c in string", 1266 | "raw": [ 1267 | "\" | \"" 1268 | ], 1269 | "header_type": "item", 1270 | "expected": [ 1271 | " | ", 1272 | [] 1273 | ] 1274 | }, 1275 | { 1276 | "name": "0x7d in string", 1277 | "raw": [ 1278 | "\" } \"" 1279 | ], 1280 | "header_type": "item", 1281 | "expected": [ 1282 | " } ", 1283 | [] 1284 | ] 1285 | }, 1286 | { 1287 | "name": "0x7e in string", 1288 | "raw": [ 1289 | "\" ~ \"" 1290 | ], 1291 | "header_type": "item", 1292 | "expected": [ 1293 | " ~ ", 1294 | [] 1295 | ] 1296 | }, 1297 | { 1298 | "name": "0x7f in string", 1299 | "raw": [ 1300 | "\" \u007f \"" 1301 | ], 1302 | "header_type": "item", 1303 | "must_fail": true 1304 | }, 1305 | { 1306 | "name": "Escaped 0x00 in string", 1307 | "raw": [ 1308 | "\"\\\u0000\"" 1309 | ], 1310 | "header_type": "item", 1311 | "must_fail": true 1312 | }, 1313 | { 1314 | "name": "Escaped 0x01 in string", 1315 | "raw": [ 1316 | "\"\\\u0001\"" 1317 | ], 1318 | "header_type": "item", 1319 | "must_fail": true 1320 | }, 1321 | { 1322 | "name": "Escaped 0x02 in string", 1323 | "raw": [ 1324 | "\"\\\u0002\"" 1325 | ], 1326 | "header_type": "item", 1327 | "must_fail": true 1328 | }, 1329 | { 1330 | "name": "Escaped 0x03 in string", 1331 | "raw": [ 1332 | "\"\\\u0003\"" 1333 | ], 1334 | "header_type": "item", 1335 | "must_fail": true 1336 | }, 1337 | { 1338 | "name": "Escaped 0x04 in string", 1339 | "raw": [ 1340 | "\"\\\u0004\"" 1341 | ], 1342 | "header_type": "item", 1343 | "must_fail": true 1344 | }, 1345 | { 1346 | "name": "Escaped 0x05 in string", 1347 | "raw": [ 1348 | "\"\\\u0005\"" 1349 | ], 1350 | "header_type": "item", 1351 | "must_fail": true 1352 | }, 1353 | { 1354 | "name": "Escaped 0x06 in string", 1355 | "raw": [ 1356 | "\"\\\u0006\"" 1357 | ], 1358 | "header_type": "item", 1359 | "must_fail": true 1360 | }, 1361 | { 1362 | "name": "Escaped 0x07 in string", 1363 | "raw": [ 1364 | "\"\\\u0007\"" 1365 | ], 1366 | "header_type": "item", 1367 | "must_fail": true 1368 | }, 1369 | { 1370 | "name": "Escaped 0x08 in string", 1371 | "raw": [ 1372 | "\"\\\b\"" 1373 | ], 1374 | "header_type": "item", 1375 | "must_fail": true 1376 | }, 1377 | { 1378 | "name": "Escaped 0x09 in string", 1379 | "raw": [ 1380 | "\"\\\t\"" 1381 | ], 1382 | "header_type": "item", 1383 | "must_fail": true 1384 | }, 1385 | { 1386 | "name": "Escaped 0x0a in string", 1387 | "raw": [ 1388 | "\"\\\n\"" 1389 | ], 1390 | "header_type": "item", 1391 | "must_fail": true 1392 | }, 1393 | { 1394 | "name": "Escaped 0x0b in string", 1395 | "raw": [ 1396 | "\"\\\u000b\"" 1397 | ], 1398 | "header_type": "item", 1399 | "must_fail": true 1400 | }, 1401 | { 1402 | "name": "Escaped 0x0c in string", 1403 | "raw": [ 1404 | "\"\\\f\"" 1405 | ], 1406 | "header_type": "item", 1407 | "must_fail": true 1408 | }, 1409 | { 1410 | "name": "Escaped 0x0d in string", 1411 | "raw": [ 1412 | "\"\\\r\"" 1413 | ], 1414 | "header_type": "item", 1415 | "must_fail": true 1416 | }, 1417 | { 1418 | "name": "Escaped 0x0e in string", 1419 | "raw": [ 1420 | "\"\\\u000e\"" 1421 | ], 1422 | "header_type": "item", 1423 | "must_fail": true 1424 | }, 1425 | { 1426 | "name": "Escaped 0x0f in string", 1427 | "raw": [ 1428 | "\"\\\u000f\"" 1429 | ], 1430 | "header_type": "item", 1431 | "must_fail": true 1432 | }, 1433 | { 1434 | "name": "Escaped 0x10 in string", 1435 | "raw": [ 1436 | "\"\\\u0010\"" 1437 | ], 1438 | "header_type": "item", 1439 | "must_fail": true 1440 | }, 1441 | { 1442 | "name": "Escaped 0x11 in string", 1443 | "raw": [ 1444 | "\"\\\u0011\"" 1445 | ], 1446 | "header_type": "item", 1447 | "must_fail": true 1448 | }, 1449 | { 1450 | "name": "Escaped 0x12 in string", 1451 | "raw": [ 1452 | "\"\\\u0012\"" 1453 | ], 1454 | "header_type": "item", 1455 | "must_fail": true 1456 | }, 1457 | { 1458 | "name": "Escaped 0x13 in string", 1459 | "raw": [ 1460 | "\"\\\u0013\"" 1461 | ], 1462 | "header_type": "item", 1463 | "must_fail": true 1464 | }, 1465 | { 1466 | "name": "Escaped 0x14 in string", 1467 | "raw": [ 1468 | "\"\\\u0014\"" 1469 | ], 1470 | "header_type": "item", 1471 | "must_fail": true 1472 | }, 1473 | { 1474 | "name": "Escaped 0x15 in string", 1475 | "raw": [ 1476 | "\"\\\u0015\"" 1477 | ], 1478 | "header_type": "item", 1479 | "must_fail": true 1480 | }, 1481 | { 1482 | "name": "Escaped 0x16 in string", 1483 | "raw": [ 1484 | "\"\\\u0016\"" 1485 | ], 1486 | "header_type": "item", 1487 | "must_fail": true 1488 | }, 1489 | { 1490 | "name": "Escaped 0x17 in string", 1491 | "raw": [ 1492 | "\"\\\u0017\"" 1493 | ], 1494 | "header_type": "item", 1495 | "must_fail": true 1496 | }, 1497 | { 1498 | "name": "Escaped 0x18 in string", 1499 | "raw": [ 1500 | "\"\\\u0018\"" 1501 | ], 1502 | "header_type": "item", 1503 | "must_fail": true 1504 | }, 1505 | { 1506 | "name": "Escaped 0x19 in string", 1507 | "raw": [ 1508 | "\"\\\u0019\"" 1509 | ], 1510 | "header_type": "item", 1511 | "must_fail": true 1512 | }, 1513 | { 1514 | "name": "Escaped 0x1a in string", 1515 | "raw": [ 1516 | "\"\\\u001a\"" 1517 | ], 1518 | "header_type": "item", 1519 | "must_fail": true 1520 | }, 1521 | { 1522 | "name": "Escaped 0x1b in string", 1523 | "raw": [ 1524 | "\"\\\u001b\"" 1525 | ], 1526 | "header_type": "item", 1527 | "must_fail": true 1528 | }, 1529 | { 1530 | "name": "Escaped 0x1c in string", 1531 | "raw": [ 1532 | "\"\\\u001c\"" 1533 | ], 1534 | "header_type": "item", 1535 | "must_fail": true 1536 | }, 1537 | { 1538 | "name": "Escaped 0x1d in string", 1539 | "raw": [ 1540 | "\"\\\u001d\"" 1541 | ], 1542 | "header_type": "item", 1543 | "must_fail": true 1544 | }, 1545 | { 1546 | "name": "Escaped 0x1e in string", 1547 | "raw": [ 1548 | "\"\\\u001e\"" 1549 | ], 1550 | "header_type": "item", 1551 | "must_fail": true 1552 | }, 1553 | { 1554 | "name": "Escaped 0x1f in string", 1555 | "raw": [ 1556 | "\"\\\u001f\"" 1557 | ], 1558 | "header_type": "item", 1559 | "must_fail": true 1560 | }, 1561 | { 1562 | "name": "Escaped 0x20 in string", 1563 | "raw": [ 1564 | "\"\\ \"" 1565 | ], 1566 | "header_type": "item", 1567 | "must_fail": true 1568 | }, 1569 | { 1570 | "name": "Escaped 0x21 in string", 1571 | "raw": [ 1572 | "\"\\!\"" 1573 | ], 1574 | "header_type": "item", 1575 | "must_fail": true 1576 | }, 1577 | { 1578 | "name": "Escaped 0x22 in string", 1579 | "raw": [ 1580 | "\"\\\"\"" 1581 | ], 1582 | "header_type": "item", 1583 | "expected": [ 1584 | "\"", 1585 | [] 1586 | ] 1587 | }, 1588 | { 1589 | "name": "Escaped 0x23 in string", 1590 | "raw": [ 1591 | "\"\\#\"" 1592 | ], 1593 | "header_type": "item", 1594 | "must_fail": true 1595 | }, 1596 | { 1597 | "name": "Escaped 0x24 in string", 1598 | "raw": [ 1599 | "\"\\$\"" 1600 | ], 1601 | "header_type": "item", 1602 | "must_fail": true 1603 | }, 1604 | { 1605 | "name": "Escaped 0x25 in string", 1606 | "raw": [ 1607 | "\"\\%\"" 1608 | ], 1609 | "header_type": "item", 1610 | "must_fail": true 1611 | }, 1612 | { 1613 | "name": "Escaped 0x26 in string", 1614 | "raw": [ 1615 | "\"\\&\"" 1616 | ], 1617 | "header_type": "item", 1618 | "must_fail": true 1619 | }, 1620 | { 1621 | "name": "Escaped 0x27 in string", 1622 | "raw": [ 1623 | "\"\\'\"" 1624 | ], 1625 | "header_type": "item", 1626 | "must_fail": true 1627 | }, 1628 | { 1629 | "name": "Escaped 0x28 in string", 1630 | "raw": [ 1631 | "\"\\(\"" 1632 | ], 1633 | "header_type": "item", 1634 | "must_fail": true 1635 | }, 1636 | { 1637 | "name": "Escaped 0x29 in string", 1638 | "raw": [ 1639 | "\"\\)\"" 1640 | ], 1641 | "header_type": "item", 1642 | "must_fail": true 1643 | }, 1644 | { 1645 | "name": "Escaped 0x2a in string", 1646 | "raw": [ 1647 | "\"\\*\"" 1648 | ], 1649 | "header_type": "item", 1650 | "must_fail": true 1651 | }, 1652 | { 1653 | "name": "Escaped 0x2b in string", 1654 | "raw": [ 1655 | "\"\\+\"" 1656 | ], 1657 | "header_type": "item", 1658 | "must_fail": true 1659 | }, 1660 | { 1661 | "name": "Escaped 0x2c in string", 1662 | "raw": [ 1663 | "\"\\,\"" 1664 | ], 1665 | "header_type": "item", 1666 | "must_fail": true 1667 | }, 1668 | { 1669 | "name": "Escaped 0x2d in string", 1670 | "raw": [ 1671 | "\"\\-\"" 1672 | ], 1673 | "header_type": "item", 1674 | "must_fail": true 1675 | }, 1676 | { 1677 | "name": "Escaped 0x2e in string", 1678 | "raw": [ 1679 | "\"\\.\"" 1680 | ], 1681 | "header_type": "item", 1682 | "must_fail": true 1683 | }, 1684 | { 1685 | "name": "Escaped 0x2f in string", 1686 | "raw": [ 1687 | "\"\\/\"" 1688 | ], 1689 | "header_type": "item", 1690 | "must_fail": true 1691 | }, 1692 | { 1693 | "name": "Escaped 0x30 in string", 1694 | "raw": [ 1695 | "\"\\0\"" 1696 | ], 1697 | "header_type": "item", 1698 | "must_fail": true 1699 | }, 1700 | { 1701 | "name": "Escaped 0x31 in string", 1702 | "raw": [ 1703 | "\"\\1\"" 1704 | ], 1705 | "header_type": "item", 1706 | "must_fail": true 1707 | }, 1708 | { 1709 | "name": "Escaped 0x32 in string", 1710 | "raw": [ 1711 | "\"\\2\"" 1712 | ], 1713 | "header_type": "item", 1714 | "must_fail": true 1715 | }, 1716 | { 1717 | "name": "Escaped 0x33 in string", 1718 | "raw": [ 1719 | "\"\\3\"" 1720 | ], 1721 | "header_type": "item", 1722 | "must_fail": true 1723 | }, 1724 | { 1725 | "name": "Escaped 0x34 in string", 1726 | "raw": [ 1727 | "\"\\4\"" 1728 | ], 1729 | "header_type": "item", 1730 | "must_fail": true 1731 | }, 1732 | { 1733 | "name": "Escaped 0x35 in string", 1734 | "raw": [ 1735 | "\"\\5\"" 1736 | ], 1737 | "header_type": "item", 1738 | "must_fail": true 1739 | }, 1740 | { 1741 | "name": "Escaped 0x36 in string", 1742 | "raw": [ 1743 | "\"\\6\"" 1744 | ], 1745 | "header_type": "item", 1746 | "must_fail": true 1747 | }, 1748 | { 1749 | "name": "Escaped 0x37 in string", 1750 | "raw": [ 1751 | "\"\\7\"" 1752 | ], 1753 | "header_type": "item", 1754 | "must_fail": true 1755 | }, 1756 | { 1757 | "name": "Escaped 0x38 in string", 1758 | "raw": [ 1759 | "\"\\8\"" 1760 | ], 1761 | "header_type": "item", 1762 | "must_fail": true 1763 | }, 1764 | { 1765 | "name": "Escaped 0x39 in string", 1766 | "raw": [ 1767 | "\"\\9\"" 1768 | ], 1769 | "header_type": "item", 1770 | "must_fail": true 1771 | }, 1772 | { 1773 | "name": "Escaped 0x3a in string", 1774 | "raw": [ 1775 | "\"\\:\"" 1776 | ], 1777 | "header_type": "item", 1778 | "must_fail": true 1779 | }, 1780 | { 1781 | "name": "Escaped 0x3b in string", 1782 | "raw": [ 1783 | "\"\\;\"" 1784 | ], 1785 | "header_type": "item", 1786 | "must_fail": true 1787 | }, 1788 | { 1789 | "name": "Escaped 0x3c in string", 1790 | "raw": [ 1791 | "\"\\<\"" 1792 | ], 1793 | "header_type": "item", 1794 | "must_fail": true 1795 | }, 1796 | { 1797 | "name": "Escaped 0x3d in string", 1798 | "raw": [ 1799 | "\"\\=\"" 1800 | ], 1801 | "header_type": "item", 1802 | "must_fail": true 1803 | }, 1804 | { 1805 | "name": "Escaped 0x3e in string", 1806 | "raw": [ 1807 | "\"\\>\"" 1808 | ], 1809 | "header_type": "item", 1810 | "must_fail": true 1811 | }, 1812 | { 1813 | "name": "Escaped 0x3f in string", 1814 | "raw": [ 1815 | "\"\\?\"" 1816 | ], 1817 | "header_type": "item", 1818 | "must_fail": true 1819 | }, 1820 | { 1821 | "name": "Escaped 0x40 in string", 1822 | "raw": [ 1823 | "\"\\@\"" 1824 | ], 1825 | "header_type": "item", 1826 | "must_fail": true 1827 | }, 1828 | { 1829 | "name": "Escaped 0x41 in string", 1830 | "raw": [ 1831 | "\"\\A\"" 1832 | ], 1833 | "header_type": "item", 1834 | "must_fail": true 1835 | }, 1836 | { 1837 | "name": "Escaped 0x42 in string", 1838 | "raw": [ 1839 | "\"\\B\"" 1840 | ], 1841 | "header_type": "item", 1842 | "must_fail": true 1843 | }, 1844 | { 1845 | "name": "Escaped 0x43 in string", 1846 | "raw": [ 1847 | "\"\\C\"" 1848 | ], 1849 | "header_type": "item", 1850 | "must_fail": true 1851 | }, 1852 | { 1853 | "name": "Escaped 0x44 in string", 1854 | "raw": [ 1855 | "\"\\D\"" 1856 | ], 1857 | "header_type": "item", 1858 | "must_fail": true 1859 | }, 1860 | { 1861 | "name": "Escaped 0x45 in string", 1862 | "raw": [ 1863 | "\"\\E\"" 1864 | ], 1865 | "header_type": "item", 1866 | "must_fail": true 1867 | }, 1868 | { 1869 | "name": "Escaped 0x46 in string", 1870 | "raw": [ 1871 | "\"\\F\"" 1872 | ], 1873 | "header_type": "item", 1874 | "must_fail": true 1875 | }, 1876 | { 1877 | "name": "Escaped 0x47 in string", 1878 | "raw": [ 1879 | "\"\\G\"" 1880 | ], 1881 | "header_type": "item", 1882 | "must_fail": true 1883 | }, 1884 | { 1885 | "name": "Escaped 0x48 in string", 1886 | "raw": [ 1887 | "\"\\H\"" 1888 | ], 1889 | "header_type": "item", 1890 | "must_fail": true 1891 | }, 1892 | { 1893 | "name": "Escaped 0x49 in string", 1894 | "raw": [ 1895 | "\"\\I\"" 1896 | ], 1897 | "header_type": "item", 1898 | "must_fail": true 1899 | }, 1900 | { 1901 | "name": "Escaped 0x4a in string", 1902 | "raw": [ 1903 | "\"\\J\"" 1904 | ], 1905 | "header_type": "item", 1906 | "must_fail": true 1907 | }, 1908 | { 1909 | "name": "Escaped 0x4b in string", 1910 | "raw": [ 1911 | "\"\\K\"" 1912 | ], 1913 | "header_type": "item", 1914 | "must_fail": true 1915 | }, 1916 | { 1917 | "name": "Escaped 0x4c in string", 1918 | "raw": [ 1919 | "\"\\L\"" 1920 | ], 1921 | "header_type": "item", 1922 | "must_fail": true 1923 | }, 1924 | { 1925 | "name": "Escaped 0x4d in string", 1926 | "raw": [ 1927 | "\"\\M\"" 1928 | ], 1929 | "header_type": "item", 1930 | "must_fail": true 1931 | }, 1932 | { 1933 | "name": "Escaped 0x4e in string", 1934 | "raw": [ 1935 | "\"\\N\"" 1936 | ], 1937 | "header_type": "item", 1938 | "must_fail": true 1939 | }, 1940 | { 1941 | "name": "Escaped 0x4f in string", 1942 | "raw": [ 1943 | "\"\\O\"" 1944 | ], 1945 | "header_type": "item", 1946 | "must_fail": true 1947 | }, 1948 | { 1949 | "name": "Escaped 0x50 in string", 1950 | "raw": [ 1951 | "\"\\P\"" 1952 | ], 1953 | "header_type": "item", 1954 | "must_fail": true 1955 | }, 1956 | { 1957 | "name": "Escaped 0x51 in string", 1958 | "raw": [ 1959 | "\"\\Q\"" 1960 | ], 1961 | "header_type": "item", 1962 | "must_fail": true 1963 | }, 1964 | { 1965 | "name": "Escaped 0x52 in string", 1966 | "raw": [ 1967 | "\"\\R\"" 1968 | ], 1969 | "header_type": "item", 1970 | "must_fail": true 1971 | }, 1972 | { 1973 | "name": "Escaped 0x53 in string", 1974 | "raw": [ 1975 | "\"\\S\"" 1976 | ], 1977 | "header_type": "item", 1978 | "must_fail": true 1979 | }, 1980 | { 1981 | "name": "Escaped 0x54 in string", 1982 | "raw": [ 1983 | "\"\\T\"" 1984 | ], 1985 | "header_type": "item", 1986 | "must_fail": true 1987 | }, 1988 | { 1989 | "name": "Escaped 0x55 in string", 1990 | "raw": [ 1991 | "\"\\U\"" 1992 | ], 1993 | "header_type": "item", 1994 | "must_fail": true 1995 | }, 1996 | { 1997 | "name": "Escaped 0x56 in string", 1998 | "raw": [ 1999 | "\"\\V\"" 2000 | ], 2001 | "header_type": "item", 2002 | "must_fail": true 2003 | }, 2004 | { 2005 | "name": "Escaped 0x57 in string", 2006 | "raw": [ 2007 | "\"\\W\"" 2008 | ], 2009 | "header_type": "item", 2010 | "must_fail": true 2011 | }, 2012 | { 2013 | "name": "Escaped 0x58 in string", 2014 | "raw": [ 2015 | "\"\\X\"" 2016 | ], 2017 | "header_type": "item", 2018 | "must_fail": true 2019 | }, 2020 | { 2021 | "name": "Escaped 0x59 in string", 2022 | "raw": [ 2023 | "\"\\Y\"" 2024 | ], 2025 | "header_type": "item", 2026 | "must_fail": true 2027 | }, 2028 | { 2029 | "name": "Escaped 0x5a in string", 2030 | "raw": [ 2031 | "\"\\Z\"" 2032 | ], 2033 | "header_type": "item", 2034 | "must_fail": true 2035 | }, 2036 | { 2037 | "name": "Escaped 0x5b in string", 2038 | "raw": [ 2039 | "\"\\[\"" 2040 | ], 2041 | "header_type": "item", 2042 | "must_fail": true 2043 | }, 2044 | { 2045 | "name": "Escaped 0x5c in string", 2046 | "raw": [ 2047 | "\"\\\\\"" 2048 | ], 2049 | "header_type": "item", 2050 | "expected": [ 2051 | "\\", 2052 | [] 2053 | ] 2054 | }, 2055 | { 2056 | "name": "Escaped 0x5d in string", 2057 | "raw": [ 2058 | "\"\\]\"" 2059 | ], 2060 | "header_type": "item", 2061 | "must_fail": true 2062 | }, 2063 | { 2064 | "name": "Escaped 0x5e in string", 2065 | "raw": [ 2066 | "\"\\^\"" 2067 | ], 2068 | "header_type": "item", 2069 | "must_fail": true 2070 | }, 2071 | { 2072 | "name": "Escaped 0x5f in string", 2073 | "raw": [ 2074 | "\"\\_\"" 2075 | ], 2076 | "header_type": "item", 2077 | "must_fail": true 2078 | }, 2079 | { 2080 | "name": "Escaped 0x60 in string", 2081 | "raw": [ 2082 | "\"\\`\"" 2083 | ], 2084 | "header_type": "item", 2085 | "must_fail": true 2086 | }, 2087 | { 2088 | "name": "Escaped 0x61 in string", 2089 | "raw": [ 2090 | "\"\\a\"" 2091 | ], 2092 | "header_type": "item", 2093 | "must_fail": true 2094 | }, 2095 | { 2096 | "name": "Escaped 0x62 in string", 2097 | "raw": [ 2098 | "\"\\b\"" 2099 | ], 2100 | "header_type": "item", 2101 | "must_fail": true 2102 | }, 2103 | { 2104 | "name": "Escaped 0x63 in string", 2105 | "raw": [ 2106 | "\"\\c\"" 2107 | ], 2108 | "header_type": "item", 2109 | "must_fail": true 2110 | }, 2111 | { 2112 | "name": "Escaped 0x64 in string", 2113 | "raw": [ 2114 | "\"\\d\"" 2115 | ], 2116 | "header_type": "item", 2117 | "must_fail": true 2118 | }, 2119 | { 2120 | "name": "Escaped 0x65 in string", 2121 | "raw": [ 2122 | "\"\\e\"" 2123 | ], 2124 | "header_type": "item", 2125 | "must_fail": true 2126 | }, 2127 | { 2128 | "name": "Escaped 0x66 in string", 2129 | "raw": [ 2130 | "\"\\f\"" 2131 | ], 2132 | "header_type": "item", 2133 | "must_fail": true 2134 | }, 2135 | { 2136 | "name": "Escaped 0x67 in string", 2137 | "raw": [ 2138 | "\"\\g\"" 2139 | ], 2140 | "header_type": "item", 2141 | "must_fail": true 2142 | }, 2143 | { 2144 | "name": "Escaped 0x68 in string", 2145 | "raw": [ 2146 | "\"\\h\"" 2147 | ], 2148 | "header_type": "item", 2149 | "must_fail": true 2150 | }, 2151 | { 2152 | "name": "Escaped 0x69 in string", 2153 | "raw": [ 2154 | "\"\\i\"" 2155 | ], 2156 | "header_type": "item", 2157 | "must_fail": true 2158 | }, 2159 | { 2160 | "name": "Escaped 0x6a in string", 2161 | "raw": [ 2162 | "\"\\j\"" 2163 | ], 2164 | "header_type": "item", 2165 | "must_fail": true 2166 | }, 2167 | { 2168 | "name": "Escaped 0x6b in string", 2169 | "raw": [ 2170 | "\"\\k\"" 2171 | ], 2172 | "header_type": "item", 2173 | "must_fail": true 2174 | }, 2175 | { 2176 | "name": "Escaped 0x6c in string", 2177 | "raw": [ 2178 | "\"\\l\"" 2179 | ], 2180 | "header_type": "item", 2181 | "must_fail": true 2182 | }, 2183 | { 2184 | "name": "Escaped 0x6d in string", 2185 | "raw": [ 2186 | "\"\\m\"" 2187 | ], 2188 | "header_type": "item", 2189 | "must_fail": true 2190 | }, 2191 | { 2192 | "name": "Escaped 0x6e in string", 2193 | "raw": [ 2194 | "\"\\n\"" 2195 | ], 2196 | "header_type": "item", 2197 | "must_fail": true 2198 | }, 2199 | { 2200 | "name": "Escaped 0x6f in string", 2201 | "raw": [ 2202 | "\"\\o\"" 2203 | ], 2204 | "header_type": "item", 2205 | "must_fail": true 2206 | }, 2207 | { 2208 | "name": "Escaped 0x70 in string", 2209 | "raw": [ 2210 | "\"\\p\"" 2211 | ], 2212 | "header_type": "item", 2213 | "must_fail": true 2214 | }, 2215 | { 2216 | "name": "Escaped 0x71 in string", 2217 | "raw": [ 2218 | "\"\\q\"" 2219 | ], 2220 | "header_type": "item", 2221 | "must_fail": true 2222 | }, 2223 | { 2224 | "name": "Escaped 0x72 in string", 2225 | "raw": [ 2226 | "\"\\r\"" 2227 | ], 2228 | "header_type": "item", 2229 | "must_fail": true 2230 | }, 2231 | { 2232 | "name": "Escaped 0x73 in string", 2233 | "raw": [ 2234 | "\"\\s\"" 2235 | ], 2236 | "header_type": "item", 2237 | "must_fail": true 2238 | }, 2239 | { 2240 | "name": "Escaped 0x74 in string", 2241 | "raw": [ 2242 | "\"\\t\"" 2243 | ], 2244 | "header_type": "item", 2245 | "must_fail": true 2246 | }, 2247 | { 2248 | "name": "Escaped 0x75 in string", 2249 | "raw": [ 2250 | "\"\\u\"" 2251 | ], 2252 | "header_type": "item", 2253 | "must_fail": true 2254 | }, 2255 | { 2256 | "name": "Escaped 0x76 in string", 2257 | "raw": [ 2258 | "\"\\v\"" 2259 | ], 2260 | "header_type": "item", 2261 | "must_fail": true 2262 | }, 2263 | { 2264 | "name": "Escaped 0x77 in string", 2265 | "raw": [ 2266 | "\"\\w\"" 2267 | ], 2268 | "header_type": "item", 2269 | "must_fail": true 2270 | }, 2271 | { 2272 | "name": "Escaped 0x78 in string", 2273 | "raw": [ 2274 | "\"\\x\"" 2275 | ], 2276 | "header_type": "item", 2277 | "must_fail": true 2278 | }, 2279 | { 2280 | "name": "Escaped 0x79 in string", 2281 | "raw": [ 2282 | "\"\\y\"" 2283 | ], 2284 | "header_type": "item", 2285 | "must_fail": true 2286 | }, 2287 | { 2288 | "name": "Escaped 0x7a in string", 2289 | "raw": [ 2290 | "\"\\z\"" 2291 | ], 2292 | "header_type": "item", 2293 | "must_fail": true 2294 | }, 2295 | { 2296 | "name": "Escaped 0x7b in string", 2297 | "raw": [ 2298 | "\"\\{\"" 2299 | ], 2300 | "header_type": "item", 2301 | "must_fail": true 2302 | }, 2303 | { 2304 | "name": "Escaped 0x7c in string", 2305 | "raw": [ 2306 | "\"\\|\"" 2307 | ], 2308 | "header_type": "item", 2309 | "must_fail": true 2310 | }, 2311 | { 2312 | "name": "Escaped 0x7d in string", 2313 | "raw": [ 2314 | "\"\\}\"" 2315 | ], 2316 | "header_type": "item", 2317 | "must_fail": true 2318 | }, 2319 | { 2320 | "name": "Escaped 0x7e in string", 2321 | "raw": [ 2322 | "\"\\~\"" 2323 | ], 2324 | "header_type": "item", 2325 | "must_fail": true 2326 | }, 2327 | { 2328 | "name": "Escaped 0x7f in string", 2329 | "raw": [ 2330 | "\"\\\u007f\"" 2331 | ], 2332 | "header_type": "item", 2333 | "must_fail": true 2334 | } 2335 | ] -------------------------------------------------------------------------------- /string.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "basic string", 4 | "raw": ["\"foo bar\""], 5 | "header_type": "item", 6 | "expected": ["foo bar", []] 7 | }, 8 | { 9 | "name": "empty string", 10 | "raw": ["\"\""], 11 | "header_type": "item", 12 | "expected": ["", []] 13 | }, 14 | { 15 | "name": "long string", 16 | "raw": ["\"foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo \""], 17 | "header_type": "item", 18 | "expected": ["foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo ", []] 19 | }, 20 | { 21 | "name": "whitespace string", 22 | "raw": ["\" \""], 23 | "header_type": "item", 24 | "expected": [" ", []] 25 | }, 26 | { 27 | "name": "non-ascii string", 28 | "raw": ["\"füü\""], 29 | "header_type": "item", 30 | "must_fail": true 31 | }, 32 | { 33 | "name": "tab in string", 34 | "raw": ["\"\t\""], 35 | "header_type": "item", 36 | "must_fail": true 37 | }, 38 | { 39 | "name": "newline in string", 40 | "raw": ["\" \n \""], 41 | "header_type": "item", 42 | "must_fail": true 43 | }, 44 | { 45 | "name": "single quoted string", 46 | "raw": ["'foo'"], 47 | "header_type": "item", 48 | "must_fail": true 49 | }, 50 | { 51 | "name": "unbalanced string", 52 | "raw": ["\"foo"], 53 | "header_type": "item", 54 | "must_fail": true 55 | }, 56 | { 57 | "name": "string quoting", 58 | "raw": ["\"foo \\\"bar\\\" \\\\ baz\""], 59 | "header_type": "item", 60 | "expected": ["foo \"bar\" \\ baz", []] 61 | }, 62 | { 63 | "name": "bad string quoting", 64 | "raw": ["\"foo \\,\""], 65 | "header_type": "item", 66 | "must_fail": true 67 | }, 68 | { 69 | "name": "ending string quote", 70 | "raw": ["\"foo \\\""], 71 | "header_type": "item", 72 | "must_fail": true 73 | }, 74 | { 75 | "name": "abruptly ending string quote", 76 | "raw": ["\"foo \\"], 77 | "header_type": "item", 78 | "must_fail": true 79 | }, 80 | { 81 | "name": "two lines string", 82 | "raw": ["\"foo", "bar\""], 83 | "header_type": "item", 84 | "can_fail": true, 85 | "expected": ["foo, bar", []] 86 | } 87 | ] 88 | -------------------------------------------------------------------------------- /token.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "basic token - item", 4 | "raw": ["a_b-c.d3:f%00/*"], 5 | "header_type": "item", 6 | "expected": [{"__type": "token", "value": "a_b-c.d3:f%00/*"}, []] 7 | }, 8 | { 9 | "name": "token with capitals - item", 10 | "raw": ["fooBar"], 11 | "header_type": "item", 12 | "expected": [{"__type": "token", "value": "fooBar"}, []] 13 | }, 14 | { 15 | "name": "token starting with capitals - item", 16 | "raw": ["FooBar"], 17 | "header_type": "item", 18 | "expected": [{"__type": "token", "value": "FooBar"}, []] 19 | }, 20 | { 21 | "name": "basic token - list", 22 | "raw": ["a_b-c3/*"], 23 | "header_type": "list", 24 | "expected": [[{"__type": "token", "value": "a_b-c3/*"}, []]] 25 | }, 26 | { 27 | "name": "token with capitals - list", 28 | "raw": ["fooBar"], 29 | "header_type": "list", 30 | "expected": [[{"__type": "token", "value": "fooBar"}, []]] 31 | }, 32 | { 33 | "name": "token starting with capitals - list", 34 | "raw": ["FooBar"], 35 | "header_type": "list", 36 | "expected": [[{"__type": "token", "value": "FooBar"}, []]] 37 | } 38 | ] 39 | --------------------------------------------------------------------------------