Skip to content

Commit 9a5f5a0

Browse files
committed
Add some test cases for tinycss2 code coverage.
1 parent 434d99a commit 9a5f5a0

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

An+B.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,15 @@
5454
"- 14N-1 ", null,
5555
"3.1n-1", null,
5656
"3 n-1", null,
57+
"3n-1foo", null,
5758

5859
" n-1", [1, -1],
5960
" +n-1", [1, -1],
6061
" -n-1", [-1, -1],
6162
"+ n-1", null,
6263
"- n-1", null,
64+
" +n-1foo", null,
65+
" -n-1foo", null,
6366

6467

6568
"3N +1", [3, 1],
@@ -69,6 +72,8 @@
6972
"- 14n +1 ", null,
7073
"3.1N +1", null,
7174
"3 n +1", null,
75+
"3n foo", null,
76+
"3n + foo", null,
7277

7378
" n +1", [1, 1],
7479
" +N +1", [1, 1],

component_value_list.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
["ident", "red--"], ">"
2323
],
2424

25-
"red0 -red --red -\\-red\\ blue 0red -0red \u0000red _Red .red rêd r\\êd \u007F\u0080\u0081", [
25+
"\\- red0 -red --red -\\-red\\ blue 0red -0red \u0000red _Red .red rêd r\\êd \u007F\u0080\u0081", [
26+
["ident", "-"], " ",
2627
["ident", "red0"], " ",
2728
["ident", "-red"], " ",
2829
["ident", "--red"], " ",

declaration_list.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
["declaration", "a", [["ident", "b"]], false]
1818
],
1919

20+
"a:b; c+:d", [
21+
["declaration", "a", [["ident", "b"]], false],
22+
["error", "invalid"]
23+
],
24+
2025
"@import 'foo.css'; a:b; @import 'bar.css'", [
2126
["at-rule", "import", [" ", ["string", "foo.css"]], null],
2227
["declaration", "a", [["ident", "b"]], false],

stylesheet_bytes.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@
6363
["at-rule", "", [], null]],
6464
"utf-8"],
6565

66+
{"css_bytes": "@charset \"ISO-8859-5\" ; @\u00E9",
67+
"comment": "@charset has to match an exact byte pattern"},
68+
[[["at-rule", "charset", [" ", ["string", "ISO-8859-5"], " "], null],
69+
["at-rule", "", [], null]],
70+
"utf-8"],
71+
6672

6773
{"css_bytes": "@\u0000c\u0000h\u0000a\u0000r\u0000s\u0000e\u0000t\u0000 \u0000\"\u0000U\u0000T\u0000F\u0000-\u00001\u00006\u0000L\u0000E\u0000\"\u0000;\u0000@\u0000\u00e9\u0000",
6874
"comment": "@charset has to be ASCII-compatible itself"},
@@ -97,6 +103,13 @@
97103
["at-rule", "é", [], null]],
98104
"iso-8859-2"],
99105

106+
{"css_bytes": "@charset \"ISO-8859-5\"; @\u00E9",
107+
"protocol_encoding": "kamoulox",
108+
"comment": "Unknow protocol encoding falls back to @charset"},
109+
[[["at-rule", "charset", [" ", ["string", "ISO-8859-5"]], null],
110+
["at-rule", "щ", [], null]],
111+
"iso-8859-5"],
112+
100113

101114
{"css_bytes": "@\u00E9", "environment_encoding": "ISO-8859-2"},
102115
[[["at-rule", "é", [], null]], "iso-8859-2"],
@@ -111,6 +124,13 @@
111124
["at-rule", "щ", [], null]],
112125
"iso-8859-5"],
113126

127+
{"css_bytes": "@charset \"kamoulox\"; @\u00E9",
128+
"environment_encoding": "ISO-8859-2",
129+
"comment": "@character with unknown encoding falls back to environment encoding"},
130+
[[["at-rule", "charset", [" ", ["string", "kamoulox"]], null],
131+
["at-rule", "é", [], null]],
132+
"iso-8859-2"],
133+
114134
{"css_bytes": "@\u00E9",
115135
"protocol_encoding": "ISO-8859-2",
116136
"environment_encoding": "ISO-8859-5",

0 commit comments

Comments
 (0)