Skip to content

Commit

Permalink
test(html/parser): Update html5lib-test (#6156)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Oct 17, 2022
1 parent 701c3c0 commit 7a38fde
Show file tree
Hide file tree
Showing 139 changed files with 1,711 additions and 769 deletions.
2 changes: 1 addition & 1 deletion crates/swc_html_codegen/tests/fixture.rs
Expand Up @@ -626,7 +626,7 @@ static IGNORE_TAG_OMISSION: &[&str] = &[
"tests18_dat/12/input.html",
"tests18_dat/21/input.html",
"tests19_dat/103/input.html",
"tests20_dat/41/input.html",
"tests20_dat/42/input.html",
"tests26_dat/2/input.html",
"plain-text-unsafe_dat/0/input.html",
"template_dat/107/input.html",
Expand Down
12 changes: 9 additions & 3 deletions crates/swc_html_parser/tests/fixture.rs
Expand Up @@ -1086,9 +1086,15 @@ fn html5lib_test_tree_construction(input: PathBuf) {

let mut file_stem = counter.to_string();

if !document_fragment.is_empty() {
file_stem += ".fragment_";
file_stem += &document_fragment.join("").replace(' ', "_");
// TODO workaround, fix - https://github.com/html5lib/html5lib-tests/pull/151
let need_skip_fragment = relative_path_to_test.contains("template_dat")
&& matches!(counter, 109 | 110 | 111);

if !need_skip_fragment {
if !document_fragment.is_empty() {
file_stem += ".fragment_";
file_stem += &document_fragment.join("").replace(' ', "_");
}
}

if scripting_enabled {
Expand Down
2 changes: 1 addition & 1 deletion crates/swc_html_parser/tests/html5lib-tests
@@ -0,0 +1,9 @@
| <!DOCTYPE html>
| <html>
| <head>
| <template>
| content
| <tr>
| <td>
| "cell"
| <body>
@@ -0,0 +1 @@
<!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
@@ -0,0 +1,130 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 59,
"ctxt": 0
},
"mode": "no-quirks",
"children": [
{
"type": "DocumentType",
"span": {
"start": 1,
"end": 16,
"ctxt": 0
},
"name": "html",
"publicId": null,
"systemId": null,
"raw": "<!DOCTYPE HTML>"
},
{
"type": "Element",
"span": {
"start": 0,
"end": 0,
"ctxt": 0
},
"tagName": "html",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Element",
"span": {
"start": 0,
"end": 0,
"ctxt": 0
},
"tagName": "head",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Element",
"span": {
"start": 16,
"end": 59,
"ctxt": 0
},
"tagName": "template",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [],
"content": {
"type": "DocumentFragment",
"span": {
"start": 16,
"end": 59,
"ctxt": 0
},
"children": [
{
"type": "Element",
"span": {
"start": 26,
"end": 48,
"ctxt": 0
},
"tagName": "tr",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Element",
"span": {
"start": 30,
"end": 43,
"ctxt": 0
},
"tagName": "td",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 34,
"end": 38,
"ctxt": 0
},
"data": "cell",
"raw": "cell"
}
],
"content": null,
"isSelfClosing": false
}
],
"content": null,
"isSelfClosing": false
}
]
},
"isSelfClosing": false
}
],
"content": null,
"isSelfClosing": false
},
{
"type": "Element",
"span": {
"start": 0,
"end": 0,
"ctxt": 0
},
"tagName": "body",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [],
"content": null,
"isSelfClosing": false
}
],
"content": null,
"isSelfClosing": false
}
]
}
Empty file.
@@ -0,0 +1,76 @@

x Document
,-[$DIR/tests/html5lib-tests-fixture/template_dat/109/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----

x Child
,-[$DIR/tests/html5lib-tests-fixture/template_dat/109/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^^^^^^^^^^^^
`----

x DocumentType
,-[$DIR/tests/html5lib-tests-fixture/template_dat/109/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^^^^^^^^^^^^
`----

x Child

x Element

x Child
,-[$DIR/tests/html5lib-tests-fixture/template_dat/109/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----

x Element
,-[$DIR/tests/html5lib-tests-fixture/template_dat/109/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----

x DocumentFragment
,-[$DIR/tests/html5lib-tests-fixture/template_dat/109/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----

x Child
,-[$DIR/tests/html5lib-tests-fixture/template_dat/109/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^^^^^^^^^^^^^^^^^^^
`----

x Element
,-[$DIR/tests/html5lib-tests-fixture/template_dat/109/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^^^^^^^^^^^^^^^^^^^
`----

x Child
,-[$DIR/tests/html5lib-tests-fixture/template_dat/109/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^^^^^^^^^^
`----

x Element
,-[$DIR/tests/html5lib-tests-fixture/template_dat/109/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^^^^^^^^^^
`----

x Child
,-[$DIR/tests/html5lib-tests-fixture/template_dat/109/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^
`----

x Text
,-[$DIR/tests/html5lib-tests-fixture/template_dat/109/input.html:1:1]
1 | <!DOCTYPE HTML><template><tr><td>cell</td></tr></template>
: ^^^^
`----
@@ -0,0 +1,13 @@
| <!DOCTYPE html>
| <html>
| <head>
| <template>
| content
| " "
| <tr>
| " "
| <td>
| "cell"
| " "
| " "
| <body>
@@ -0,0 +1 @@
<!DOCTYPE HTML><template> <tr> <td>cell</td> </tr> </template>

1 comment on commit 7a38fde

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 7a38fde Previous: d46a19b Ratio
es/full/minify/libraries/antd 1832264779 ns/iter (± 26573201) 1959122788 ns/iter (± 114346357) 0.94
es/full/minify/libraries/d3 404751114 ns/iter (± 24224896) 426823348 ns/iter (± 15283137) 0.95
es/full/minify/libraries/echarts 1593717215 ns/iter (± 45601964) 1629225489 ns/iter (± 77931279) 0.98
es/full/minify/libraries/jquery 105526324 ns/iter (± 5910146) 121351301 ns/iter (± 5405295) 0.87
es/full/minify/libraries/lodash 143871380 ns/iter (± 22775796) 128926865 ns/iter (± 6642282) 1.12
es/full/minify/libraries/moment 93852280 ns/iter (± 51332303) 65361811 ns/iter (± 3795864) 1.44
es/full/minify/libraries/react 22476718 ns/iter (± 849475) 24593078 ns/iter (± 960018) 0.91
es/full/minify/libraries/terser 373633083 ns/iter (± 15467545) 364703586 ns/iter (± 25018400) 1.02
es/full/minify/libraries/three 612301692 ns/iter (± 46966500) 623310520 ns/iter (± 40559729) 0.98
es/full/minify/libraries/typescript 3578813848 ns/iter (± 135613788) 3808806250 ns/iter (± 71778871) 0.94
es/full/minify/libraries/victory 855505991 ns/iter (± 77620340) 908073823 ns/iter (± 34704156) 0.94
es/full/minify/libraries/vue 176256702 ns/iter (± 12413543) 182892907 ns/iter (± 13043894) 0.96
es/full/codegen/es3 34381 ns/iter (± 1352) 34380 ns/iter (± 2034) 1.00
es/full/codegen/es5 34595 ns/iter (± 2404) 34019 ns/iter (± 1681) 1.02
es/full/codegen/es2015 34400 ns/iter (± 2170) 34098 ns/iter (± 1503) 1.01
es/full/codegen/es2016 36042 ns/iter (± 29512) 34156 ns/iter (± 2289) 1.06
es/full/codegen/es2017 37312 ns/iter (± 10317) 34141 ns/iter (± 2175) 1.09
es/full/codegen/es2018 34417 ns/iter (± 1138) 34570 ns/iter (± 2738) 1.00
es/full/codegen/es2019 34093 ns/iter (± 1730) 34356 ns/iter (± 2413) 0.99
es/full/codegen/es2020 34425 ns/iter (± 3063) 34222 ns/iter (± 1818) 1.01
es/full/all/es3 214741877 ns/iter (± 37064591) 243905038 ns/iter (± 15957710) 0.88
es/full/all/es5 195822870 ns/iter (± 16247609) 230725667 ns/iter (± 16424476) 0.85
es/full/all/es2015 155090964 ns/iter (± 11013410) 182181842 ns/iter (± 14133133) 0.85
es/full/all/es2016 156082469 ns/iter (± 9342338) 183705985 ns/iter (± 19873628) 0.85
es/full/all/es2017 153013247 ns/iter (± 9197242) 155196707 ns/iter (± 8772843) 0.99
es/full/all/es2018 162983817 ns/iter (± 17288485) 151255049 ns/iter (± 8137118) 1.08
es/full/all/es2019 182815746 ns/iter (± 18724098) 151914465 ns/iter (± 10700931) 1.20
es/full/all/es2020 155555979 ns/iter (± 13591650) 148285241 ns/iter (± 10793044) 1.05
es/full/parser 738495 ns/iter (± 42463) 759598 ns/iter (± 37437) 0.97
es/full/base/fixer 26995 ns/iter (± 1929) 27075 ns/iter (± 1262) 1.00
es/full/base/resolver_and_hygiene 94334 ns/iter (± 7712) 95723 ns/iter (± 6090) 0.99
serialization of ast node 207 ns/iter (± 11) 210 ns/iter (± 8) 0.99
serialization of serde 211 ns/iter (± 5) 227 ns/iter (± 5) 0.93

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.