Skip to content

Commit

Permalink
test(css/parser): Improve tests (#4963)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Jun 13, 2022
1 parent 91cff0a commit 1b7b4f0
Show file tree
Hide file tree
Showing 161 changed files with 45,821 additions and 1,301 deletions.
310 changes: 178 additions & 132 deletions crates/swc_css_parser/tests/fixture.rs

Large diffs are not rendered by default.

135 changes: 135 additions & 0 deletions crates/swc_css_parser/tests/line-comment/css-in-js/1/span.rust-debug
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@

x Stylesheet
,-[$DIR/tests/line-comment/css-in-js/1/input.css:1:1]
1 | ,-> // Line comment
2 | | foo {
3 | | color: red;
4 | `-> }
`----

x Rule
,-[$DIR/tests/line-comment/css-in-js/1/input.css:1:1]
1 | ,-> // Line comment
2 | | foo {
3 | | color: red;
4 | `-> }
`----

x QualifiedRule
,-[$DIR/tests/line-comment/css-in-js/1/input.css:1:1]
1 | ,-> // Line comment
2 | | foo {
3 | | color: red;
4 | `-> }
`----

x Tokens
,-[$DIR/tests/line-comment/css-in-js/1/input.css:1:1]
1 | ,-> // Line comment
2 | `-> foo {
`----

x Delim { value: '/' }
,-[$DIR/tests/line-comment/css-in-js/1/input.css:1:1]
1 | // Line comment
: ^
`----

x Delim { value: '/' }
,-[$DIR/tests/line-comment/css-in-js/1/input.css:1:1]
1 | // Line comment
: ^
`----

x WhiteSpace { value: Atom(' ' type=inline) }
,-[$DIR/tests/line-comment/css-in-js/1/input.css:1:1]
1 | // Line comment
: ^
`----

x Ident { value: Atom('Line' type=inline), raw: Atom('Line' type=inline) }
,-[$DIR/tests/line-comment/css-in-js/1/input.css:1:1]
1 | // Line comment
: ^^^^
`----

x WhiteSpace { value: Atom(' ' type=inline) }
,-[$DIR/tests/line-comment/css-in-js/1/input.css:1:1]
1 | // Line comment
: ^
`----

x Ident { value: Atom('comment' type=inline), raw: Atom('comment' type=inline) }
,-[$DIR/tests/line-comment/css-in-js/1/input.css:1:1]
1 | // Line comment
: ^^^^^^^
`----

x WhiteSpace { value: Atom('
| ' type=inline) }
,-[$DIR/tests/line-comment/css-in-js/1/input.css:1:1]
1 | // Line comment
: ^
2 | foo {
`----

x Ident { value: Atom('foo' type=inline), raw: Atom('foo' type=inline) }
,-[$DIR/tests/line-comment/css-in-js/1/input.css:2:1]
2 | foo {
: ^^^
`----

x WhiteSpace { value: Atom(' ' type=inline) }
,-[$DIR/tests/line-comment/css-in-js/1/input.css:2:1]
2 | foo {
: ^
`----

x SimpleBlock
,-[$DIR/tests/line-comment/css-in-js/1/input.css:2:1]
2 | ,-> foo {
3 | | color: red;
4 | `-> }
`----

x ComponentValue
,-[$DIR/tests/line-comment/css-in-js/1/input.css:3:5]
3 | color: red;
: ^^^^^^^^^^
`----

x StyleBlock
,-[$DIR/tests/line-comment/css-in-js/1/input.css:3:5]
3 | color: red;
: ^^^^^^^^^^
`----

x Declaration
,-[$DIR/tests/line-comment/css-in-js/1/input.css:3:5]
3 | color: red;
: ^^^^^^^^^^
`----

x DeclarationName
,-[$DIR/tests/line-comment/css-in-js/1/input.css:3:5]
3 | color: red;
: ^^^^^
`----

x Ident
,-[$DIR/tests/line-comment/css-in-js/1/input.css:3:5]
3 | color: red;
: ^^^^^
`----

x ComponentValue
,-[$DIR/tests/line-comment/css-in-js/1/input.css:3:5]
3 | color: red;
: ^^^
`----

x Ident
,-[$DIR/tests/line-comment/css-in-js/1/input.css:3:5]
3 | color: red;
: ^^^
`----
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@

x Stylesheet
,-[$DIR/tests/line-comment/css-in-js/10/input.css:1:1]
1 | // Only comment // test
: ^^^^^^^^^^^^^^^^^^^^^^^
`----

x Rule
,-[$DIR/tests/line-comment/css-in-js/10/input.css:1:1]
1 | // Only comment // test
: ^^^^^^^^^^^^^^^^^^^^^^^
`----

x Tokens
,-[$DIR/tests/line-comment/css-in-js/10/input.css:1:1]
1 | // Only comment // test
: ^^^^^^^^^^^^^^^^^^^^^^^
`----

x Delim { value: '/' }
,-[$DIR/tests/line-comment/css-in-js/10/input.css:1:1]
1 | // Only comment // test
: ^
`----

x Delim { value: '/' }
,-[$DIR/tests/line-comment/css-in-js/10/input.css:1:1]
1 | // Only comment // test
: ^
`----

x WhiteSpace { value: Atom(' ' type=inline) }
,-[$DIR/tests/line-comment/css-in-js/10/input.css:1:1]
1 | // Only comment // test
: ^
`----

x Ident { value: Atom('Only' type=inline), raw: Atom('Only' type=inline) }
,-[$DIR/tests/line-comment/css-in-js/10/input.css:1:1]
1 | // Only comment // test
: ^^^^
`----

x WhiteSpace { value: Atom(' ' type=inline) }
,-[$DIR/tests/line-comment/css-in-js/10/input.css:1:1]
1 | // Only comment // test
: ^
`----

x Ident { value: Atom('comment' type=inline), raw: Atom('comment' type=inline) }
,-[$DIR/tests/line-comment/css-in-js/10/input.css:1:1]
1 | // Only comment // test
: ^^^^^^^
`----

x WhiteSpace { value: Atom(' ' type=inline) }
,-[$DIR/tests/line-comment/css-in-js/10/input.css:1:1]
1 | // Only comment // test
: ^
`----

x Delim { value: '/' }
,-[$DIR/tests/line-comment/css-in-js/10/input.css:1:1]
1 | // Only comment // test
: ^
`----

x Delim { value: '/' }
,-[$DIR/tests/line-comment/css-in-js/10/input.css:1:1]
1 | // Only comment // test
: ^
`----

x WhiteSpace { value: Atom(' ' type=inline) }
,-[$DIR/tests/line-comment/css-in-js/10/input.css:1:1]
1 | // Only comment // test
: ^
`----

x Ident { value: Atom('test' type=inline), raw: Atom('test' type=inline) }
,-[$DIR/tests/line-comment/css-in-js/10/input.css:1:1]
1 | // Only comment // test
: ^^^^
`----
165 changes: 165 additions & 0 deletions crates/swc_css_parser/tests/line-comment/css-in-js/2/span.rust-debug
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@

x Stylesheet
,-[$DIR/tests/line-comment/css-in-js/2/input.css:1:1]
1 | ,-> foo {
2 | | // Line comment
3 | | color: red;
4 | `-> }
`----

x Rule
,-[$DIR/tests/line-comment/css-in-js/2/input.css:1:1]
1 | ,-> foo {
2 | | // Line comment
3 | | color: red;
4 | `-> }
`----

x QualifiedRule
,-[$DIR/tests/line-comment/css-in-js/2/input.css:1:1]
1 | ,-> foo {
2 | | // Line comment
3 | | color: red;
4 | `-> }
`----

x SelectorList
,-[$DIR/tests/line-comment/css-in-js/2/input.css:1:1]
1 | foo {
: ^^^
`----

x ComplexSelector
,-[$DIR/tests/line-comment/css-in-js/2/input.css:1:1]
1 | foo {
: ^^^
`----

x CompoundSelector
,-[$DIR/tests/line-comment/css-in-js/2/input.css:1:1]
1 | foo {
: ^^^
`----

x TypeSelector
,-[$DIR/tests/line-comment/css-in-js/2/input.css:1:1]
1 | foo {
: ^^^
`----

x TagNameSelector
,-[$DIR/tests/line-comment/css-in-js/2/input.css:1:1]
1 | foo {
: ^^^
`----

x WqName
,-[$DIR/tests/line-comment/css-in-js/2/input.css:1:1]
1 | foo {
: ^^^
`----

x Ident
,-[$DIR/tests/line-comment/css-in-js/2/input.css:1:1]
1 | foo {
: ^^^
`----

x SimpleBlock
,-[$DIR/tests/line-comment/css-in-js/2/input.css:1:1]
1 | ,-> foo {
2 | | // Line comment
3 | | color: red;
4 | `-> }
`----

x ComponentValue
,-[$DIR/tests/line-comment/css-in-js/2/input.css:2:5]
2 | ,-> // Line comment
3 | `-> color: red;
`----

x StyleBlock
,-[$DIR/tests/line-comment/css-in-js/2/input.css:2:5]
2 | ,-> // Line comment
3 | `-> color: red;
`----

x Tokens
,-[$DIR/tests/line-comment/css-in-js/2/input.css:2:5]
2 | ,-> // Line comment
3 | `-> color: red;
`----

x Delim { value: '/' }
,-[$DIR/tests/line-comment/css-in-js/2/input.css:2:5]
2 | // Line comment
: ^
`----

x Delim { value: '/' }
,-[$DIR/tests/line-comment/css-in-js/2/input.css:2:5]
2 | // Line comment
: ^
`----

x WhiteSpace { value: Atom(' ' type=inline) }
,-[$DIR/tests/line-comment/css-in-js/2/input.css:2:5]
2 | // Line comment
: ^
`----

x Ident { value: Atom('Line' type=inline), raw: Atom('Line' type=inline) }
,-[$DIR/tests/line-comment/css-in-js/2/input.css:2:5]
2 | // Line comment
: ^^^^
`----

x WhiteSpace { value: Atom(' ' type=inline) }
,-[$DIR/tests/line-comment/css-in-js/2/input.css:2:5]
2 | // Line comment
: ^
`----

x Ident { value: Atom('comment' type=inline), raw: Atom('comment' type=inline) }
,-[$DIR/tests/line-comment/css-in-js/2/input.css:2:5]
2 | // Line comment
: ^^^^^^^
`----

x WhiteSpace { value: Atom('
| ' type=inline) }
,-[$DIR/tests/line-comment/css-in-js/2/input.css:2:5]
2 | ,-> // Line comment
3 | `-> color: red;
`----

x Ident { value: Atom('color' type=inline), raw: Atom('color' type=inline) }
,-[$DIR/tests/line-comment/css-in-js/2/input.css:3:5]
3 | color: red;
: ^^^^^
`----

x Colon
,-[$DIR/tests/line-comment/css-in-js/2/input.css:3:5]
3 | color: red;
: ^
`----

x WhiteSpace { value: Atom(' ' type=inline) }
,-[$DIR/tests/line-comment/css-in-js/2/input.css:3:5]
3 | color: red;
: ^
`----

x Ident { value: Atom('red' type=inline), raw: Atom('red' type=inline) }
,-[$DIR/tests/line-comment/css-in-js/2/input.css:3:5]
3 | color: red;
: ^^^
`----

x Semi
,-[$DIR/tests/line-comment/css-in-js/2/input.css:3:5]
3 | color: red;
: ^
`----

0 comments on commit 1b7b4f0

Please sign in to comment.