@@ -16,7 +16,7 @@ Importing
16
16
The recommended way to use these tests in an implementation
17
17
is to import them with git-subtree _.
18
18
19
- .. _git-subtree : https://github.com/apenwarr /git- subtree
19
+ .. _git-subtree : https://github.com/git /git/tree/master/contrib/ subtree
20
20
21
21
To import the first time to a ``./css-parsing-tests `` sub-directory,
22
22
run this from the top-level of a git repository::
@@ -28,6 +28,59 @@ Later, to merge changes made in the upstream repository, run::
28
28
git subtree pull -P css-parsing-tests https://github.com/SimonSapin/css-parsing-tests.git master
29
29
30
30
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
+
31
84
Result representation
32
85
=====================
33
86
@@ -40,6 +93,38 @@ they are represented as ``["at-keyword", "import"]`` and ``["ident", "@import"]`
40
93
respectively.
41
94
42
95
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
+
43
128
Component values
44
129
----------------
45
130
@@ -123,37 +208,32 @@ Component values
123
208
124
209
{} block
125
210
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 .
127
212
128
213
[] block
129
214
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 .
131
216
132
217
() block
133
218
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 .
135
220
136
221
Function
137
222
An array of length N+2: the string ``"function" ``
138
223
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 .
140
225
226
+ <bad-string>
227
+ The array of two strings ``["error", "bad-string"] ``.
141
228
142
- Other nodes
143
- -----------
229
+ <bad-url>
230
+ The array of two strings `` ["error", "bad-url"] ``.
144
231
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", "}"] ``.
149
234
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", "]"] ``.
155
237
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