Understand the JSON test file format
mainEach .json file in the test suite corresponds to a specific CSS parsing function. The files are UTF-8 encoded and follow a specific structure:
- The file contains a single JSON array.
- The array contains an even number of items.
- Items are organized in pairs:
[input, expected_result].
Common Test Files
| File | Purpose |
|---|---|
stylesheet.json | Tests parsing a full stylesheet. |
rule_list.json | Tests parsing a list of rules. |
declaration_list.json | Tests parsing a list of declarations. |
one_rule.json | Tests parsing a single rule. |
one_declaration.json | Tests parsing a single declaration. |
component_value_list.json | Tests parsing a list of component values. |
color3.json | Tests <color> syntax (outputs RGBA arrays). |
An+B.json | Tests An+B syntax (outputs [A, B] integers). |
urange.json | Tests urange syntax (outputs [start, end] integers). |
Special Input Formats
For stylesheet_bytes.json, the input is a JSON object containing:
css_bytes: The input byte string (U+0000 to U+00FF represent raw bytes).protocol_encoding(optional): A string label ornull.environment_encoding(optional): A string label ornull.comment(optional): Ignored.