]> git.proxmox.com Git - rustc.git/blob - vendor/html5ever/html5lib-tests/serializer/core.test
New upstream version 1.42.0+dfsg0+pve1
[rustc.git] / vendor / html5ever / html5lib-tests / serializer / core.test
1 {"tests": [
2
3 {"description": "proper attribute value escaping",
4 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "test \"with\" ""}]]],
5 "expected": ["<span title='test \"with\" &amp;quot;'>"]
6 },
7
8 {"description": "proper attribute value non-quoting",
9 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo"}]]],
10 "expected": ["<span title=foo>"],
11 "xhtml": ["<span title=\"foo\">"]
12 },
13
14 {"description": "proper attribute value non-quoting (with <)",
15 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo<bar"}]]],
16 "expected": ["<span title=foo<bar>"],
17 "xhtml": ["<span title=\"foo&lt;bar\">"]
18 },
19
20 {"description": "proper attribute value quoting (with =)",
21 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo=bar"}]]],
22 "expected": ["<span title=\"foo=bar\">"]
23 },
24
25 {"description": "proper attribute value quoting (with >)",
26 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo>bar"}]]],
27 "expected": ["<span title=\"foo>bar\">"]
28 },
29
30 {"description": "proper attribute value quoting (with \")",
31 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo\"bar"}]]],
32 "expected": ["<span title='foo\"bar'>"]
33 },
34
35 {"description": "proper attribute value quoting (with ')",
36 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo'bar"}]]],
37 "expected": ["<span title=\"foo'bar\">"]
38 },
39
40 {"description": "proper attribute value quoting (with both \" and ')",
41 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo'bar\"baz"}]]],
42 "expected": ["<span title=\"foo'bar&quot;baz\">"]
43 },
44
45 {"description": "proper attribute value quoting (with space)",
46 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo bar"}]]],
47 "expected": ["<span title=\"foo bar\">"]
48 },
49
50 {"description": "proper attribute value quoting (with tab)",
51 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo\tbar"}]]],
52 "expected": ["<span title=\"foo\tbar\">"]
53 },
54
55 {"description": "proper attribute value quoting (with LF)",
56 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo\nbar"}]]],
57 "expected": ["<span title=\"foo\nbar\">"]
58 },
59
60 {"description": "proper attribute value quoting (with CR)",
61 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo\rbar"}]]],
62 "expected": ["<span title=\"foo\rbar\">"]
63 },
64
65 {"description": "proper attribute value non-quoting (with linetab)",
66 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo\u000Bbar"}]]],
67 "expected": ["<span title=foo\u000Bbar>"],
68 "xhtml": ["<span title=\"foo\u000Bbar\">"]
69 },
70
71 {"description": "proper attribute value quoting (with form feed)",
72 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo\u000Cbar"}]]],
73 "expected": ["<span title=\"foo\u000Cbar\">"]
74 },
75
76 {"description": "void element (as EmptyTag token)",
77 "input": [["EmptyTag", "img", {}]],
78 "expected": ["<img>"],
79 "xhtml": ["<img />"]
80 },
81
82 {"description": "void element (as StartTag token)",
83 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "img", {}]],
84 "expected": ["<img>"],
85 "xhtml": ["<img />"]
86 },
87
88 {"description": "doctype in error",
89 "input": [["Doctype", "foo"]],
90 "expected": ["<!DOCTYPE foo>"]
91 },
92
93 {"description": "character data",
94 "options": {"encoding":"utf-8"},
95 "input": [["Characters", "a<b>c&d"]],
96 "expected": ["a&lt;b&gt;c&amp;d"]
97 },
98
99 {"description": "rcdata",
100 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "script", {}], ["Characters", "a<b>c&d"]],
101 "expected": ["<script>a<b>c&d"],
102 "xhtml": ["<script>a&lt;b&gt;c&amp;d"]
103 },
104
105 {"description": "doctype",
106 "input": [["Doctype", "HTML"]],
107 "expected": ["<!DOCTYPE HTML>"]
108 },
109
110 {"description": "HTML 4.01 DOCTYPE",
111 "input": [["Doctype", "HTML", "-//W3C//DTD HTML 4.01//EN", "http://www.w3.org/TR/html4/strict.dtd"]],
112 "expected": ["<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">"]
113 },
114
115 {"description": "HTML 4.01 DOCTYPE without system identifer",
116 "input": [["Doctype", "HTML", "-//W3C//DTD HTML 4.01//EN"]],
117 "expected": ["<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\">"]
118 },
119
120 {"description": "IBM DOCTYPE without public identifer",
121 "input": [["Doctype", "html", "", "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"]],
122 "expected": ["<!DOCTYPE html SYSTEM \"http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd\">"]
123 }
124
125 ]}