Skip to content

Commit 19d5adc

Browse files
committed
Document each .json file in README.rst
1 parent 4e3c2f2 commit 19d5adc

File tree

1 file changed

+100
-20
lines changed

1 file changed

+100
-20
lines changed

README.rst

Lines changed: 100 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Importing
1616
The recommended way to use these tests in an implementation
1717
is to import them with git-subtree_.
1818

19-
.. _git-subtree: https://github.com/apenwarr/git-subtree
19+
.. _git-subtree: https://github.com/git/git/tree/master/contrib/subtree
2020

2121
To import the first time to a ``./css-parsing-tests`` sub-directory,
2222
run this from the top-level of a git repository::
@@ -28,6 +28,59 @@ Later, to merge changes made in the upstream repository, run::
2828
git subtree pull -P css-parsing-tests https://github.com/SimonSapin/css-parsing-tests.git master
2929

3030

31+
Test files
32+
==========
33+
34+
CSS Syntax specification describes a number of "functions".
35+
Each ``.json`` file in this repository corresponds to such a function.
36+
The files are encoded as UTF-8
37+
and each contain a JSON array with an even number of items,
38+
where each pair of items is one function input
39+
associated with the expected result.
40+
41+
``component_value_list.json``
42+
Tests `Parse a list of component values
43+
<http://dev.w3.org/csswg/css-syntax-3/#parse-a-list-of-component-values>`_.
44+
The Unicode input is represented by a JSON string,
45+
the output as an array of `component values`_ as described below.
46+
47+
``component_value_list.json``
48+
Tests `Parse a component value
49+
<http://dev.w3.org/csswg/css-syntax-3/#parse-a-component-value>`_.
50+
The Unicode input is represented by a JSON string,
51+
the output as a `component value`_.
52+
53+
``declaration_list.json``
54+
Tests `Parse a list of declarations
55+
<http://dev.w3.org/csswg/css-syntax-3/#parse-a-list-of-declarations>`_.
56+
The Unicode input is represented by a JSON string,
57+
the output as an array of declarations_ and at-rules_.
58+
59+
``one_declaration.json``
60+
Tests `Parse a declaration
61+
<http://dev.w3.org/csswg/css-syntax-3/#parse-a-declaration>`_.
62+
The Unicode input is represented by a JSON string,
63+
the output as a declaration_.
64+
65+
``one_rule.json``
66+
Tests `Parse a rule
67+
<http://dev.w3.org/csswg/css-syntax-3/#parse-a-rule>`_.
68+
The Unicode input is represented by a JSON string,
69+
the output as a `qualified rule`_ or at-rule_.
70+
71+
``rule_list.json``
72+
Tests `Parse a list of rules
73+
<http://dev.w3.org/csswg/css-syntax-3/#parse-a-list-of-rules>`_.
74+
The Unicode input is represented by a JSON string,
75+
the output as a list of `qualified rules`_ or at-rules_.
76+
77+
``stylesheet.json``
78+
Tests `Parse a stylesheet
79+
<http://dev.w3.org/csswg/css-syntax-3/#parse-a-stylesheet>`_.
80+
The Unicode input is represented by a JSON string,
81+
the output as a list of `qualified rules`_ or at-rules_.
82+
83+
3184
Result representation
3285
=====================
3386

@@ -40,6 +93,38 @@ they are represented as ``["at-keyword", "import"]`` and ``["ident", "@import"]`
4093
respectively.
4194

4295

96+
Rules and declarations
97+
----------------------
98+
99+
.. _at-rule:
100+
.. _at-rules:
101+
.. _qualified rule:
102+
.. _qualified rules:
103+
.. _declaration:
104+
.. _declarations:
105+
106+
107+
At-rule
108+
An array of length 4: the string ``"at-rule"``,
109+
the name (value of the at-keyword) as a string,
110+
the prelude as a nested array of `component values`_,
111+
and the optional block as a nested array of component value, or null.
112+
113+
Qualified rule
114+
An array of length 3: the string ``"qualified rule"``,
115+
the prelude as a nested array of `component values`_,
116+
and the block as a nested array of component value.
117+
118+
119+
Declaration
120+
An array of length 4: the string ``"declaration"``, the name as a string,
121+
the value as a nested array of `component values`_,
122+
and a the important flag as a boolean.
123+
124+
125+
.. _component value:
126+
.. _component values:
127+
43128
Component values
44129
----------------
45130

@@ -123,37 +208,32 @@ Component values
123208

124209
{} block
125210
An array of length N+1: the string ``"{}"``
126-
followed by the N component values of the block’s value.
211+
followed by the N `component values`_ of the block’s content.
127212

128213
[] block
129214
An array of length N+1: the string ``"[]"``
130-
followed by the N component values of the block’s value.
215+
followed by the N `component values`_ of the block’s content.
131216

132217
() block
133218
An array of length N+1: the string ``"()"``
134-
followed by the N component values of the block’s value.
219+
followed by the N `component values`_ of the block’s content.
135220

136221
Function
137222
An array of length N+2: the string ``"function"``
138223
and the name of the function as a string
139-
followed by the N component values of the function’s value.
224+
followed by the N `component values`_ of the function’s arguments.
140225

226+
<bad-string>
227+
The array of two strings ``["error", "bad-string"]``.
141228

142-
Other nodes
143-
-----------
229+
<bad-url>
230+
The array of two strings ``["error", "bad-url"]``.
144231

145-
Declaration
146-
An array of length 4: the string ``"declaration"``, the name as a string,
147-
the value as a nested array of component values,
148-
and a the important flag as a boolean.
232+
Unmatched <}>
233+
The array of two strings ``["error", "}"]``.
149234

150-
At-rule
151-
An array of length 4: the string ``"at-rule"``,
152-
the name (value of the at-keyword) as a string,
153-
the prelude as a nested array of component values,
154-
and the optional block as a nested array of component value, or null.
235+
Unmatched <]>
236+
The array of two strings ``["error", "]"]``.
155237

156-
Qualified rule
157-
An array of length 3: the string ``"qualified rule"``,
158-
the prelude as a nested array of component values,
159-
and the block as a nested array of component value.
238+
Unmatched <)>
239+
The array of two strings ``["error", ")"]``.

0 commit comments

Comments
 (0)