Skip to content

Commit

Permalink
test(css/parser): Add a test for BOM (#2686)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait authored Nov 9, 2021
1 parent 368b9e2 commit ca2338e
Show file tree
Hide file tree
Showing 3 changed files with 198 additions and 0 deletions.
3 changes: 3 additions & 0 deletions css/parser/tests/fixture/bom/input.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
a {
color: red;
}
108 changes: 108 additions & 0 deletions css/parser/tests/fixture/bom/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"type": "Stylesheet",
"span": {
"start": 0,
"end": 21,
"ctxt": 0
},
"rules": [
{
"type": "StyleRule",
"span": {
"start": 0,
"end": 21,
"ctxt": 0
},
"selectors": {
"type": "SelectorList",
"span": {
"start": 0,
"end": 1,
"ctxt": 0
},
"children": [
{
"type": "ComplexSelector",
"span": {
"start": 0,
"end": 1,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 0,
"end": 1,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": {
"type": "TypeSelector",
"span": {
"start": 0,
"end": 1,
"ctxt": 0
},
"prefix": null,
"name": {
"type": "Text",
"span": {
"start": 0,
"end": 1,
"ctxt": 0
},
"value": "a",
"raw": "a"
}
},
"subclassSelectors": []
}
]
}
]
},
"block": {
"type": "Block",
"span": {
"start": 2,
"end": 21,
"ctxt": 0
},
"items": [
{
"type": "Declaration",
"span": {
"start": 8,
"end": 18,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 8,
"end": 13,
"ctxt": 0
},
"value": "color",
"raw": "color"
},
"value": [
{
"type": "Text",
"span": {
"start": 15,
"end": 18,
"ctxt": 0
},
"value": "red",
"raw": "red"
}
],
"important": null
}
]
}
}
]
}
87 changes: 87 additions & 0 deletions css/parser/tests/fixture/bom/span.rust-debug
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
error: Stylesheet
--> $DIR/tests/fixture/bom/input.css:1:1
|
1 | / a {
2 | | color: red;
3 | | }
| |_^

error: Rule
--> $DIR/tests/fixture/bom/input.css:1:1
|
1 | / a {
2 | | color: red;
3 | | }
| |_^

error: StyleRule
--> $DIR/tests/fixture/bom/input.css:1:1
|
1 | / a {
2 | | color: red;
3 | | }
| |_^

error: SelectorList
--> $DIR/tests/fixture/bom/input.css:1:1
|
1 | a {
| ^

error: ComplexSelector
--> $DIR/tests/fixture/bom/input.css:1:1
|
1 | a {
| ^

error: CompoundSelector
--> $DIR/tests/fixture/bom/input.css:1:1
|
1 | a {
| ^

error: TypeSelector
--> $DIR/tests/fixture/bom/input.css:1:1
|
1 | a {
| ^

error: Text
--> $DIR/tests/fixture/bom/input.css:1:1
|
1 | a {
| ^

error: Block
--> $DIR/tests/fixture/bom/input.css:1:3
|
1 | a {
| ___^
2 | | color: red;
3 | | }
| |_^

error: Declaration
--> $DIR/tests/fixture/bom/input.css:2:5
|
2 | color: red;
| ^^^^^^^^^^

error: Text
--> $DIR/tests/fixture/bom/input.css:2:5
|
2 | color: red;
| ^^^^^

error: Value
--> $DIR/tests/fixture/bom/input.css:2:12
|
2 | color: red;
| ^^^

error: Text
--> $DIR/tests/fixture/bom/input.css:2:12
|
2 | color: red;
| ^^^

0 comments on commit ca2338e

Please sign in to comment.