]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc-ui/invalid-html-tags.rs
Enforce closing HTML tags to have a ">" character
[rust.git] / src / test / rustdoc-ui / invalid-html-tags.rs
1 #![deny(invalid_html_tags)]
2
3 //! <p>💩<p>
4 //~^ ERROR unclosed HTML tag `p`
5 //~^^ ERROR unclosed HTML tag `p`
6
7 /// <img><input>
8 /// <script>
9 /// <img><input>
10 /// </script>
11 /// <unknown>
12 //~^ ERROR unclosed HTML tag `unknown`
13 /// < ok
14 /// <script>
15 //~^ ERROR unclosed HTML tag `script`
16 pub fn foo() {}
17
18 /// <h1>
19 ///   <h2>
20 //~^ ERROR unclosed HTML tag `h2`
21 ///     <h3>
22 //~^ ERROR unclosed HTML tag `h3`
23 /// </h1>
24 /// </hello>
25 //~^ ERROR unopened HTML tag `hello`
26 pub fn bar() {}
27
28 /// <div>
29 ///    <br/> <p>
30 //~^ ERROR unclosed HTML tag `p`
31 /// </div>
32 pub fn a() {}
33
34 /// <div>
35 ///   <p>
36 ///      <div></div>
37 ///   </p>
38 /// </div>
39 pub fn b() {}
40
41 /// <div style="hello">
42 //~^ ERROR unclosed HTML tag `div`
43 ///   <h3>
44 //~^ ERROR unclosed HTML tag `h3`
45 /// <script
46 //~^ ERROR unclosed HTML tag `script`
47 pub fn c() {}
48
49 // Unclosed tags shouldn't warn if they are nested inside a <script> elem.
50 /// <script>
51 ///   <h3><div>
52 /// </script>
53 /// <script>
54 ///   <div>
55 ///     <p>
56 ///   </div>
57 /// </script>
58 pub fn d() {}
59
60 // Unclosed tags shouldn't warn if they are nested inside a <style> elem.
61 /// <style>
62 ///   <h3><div>
63 /// </style>
64 /// <stYle>
65 ///   <div>
66 ///     <p>
67 ///   </div>
68 /// </style>
69 pub fn e() {}
70
71 // Closing tags need to have ">" at the end, otherwise it's not a closing tag!
72 /// <div></div >
73 /// <div></div
74 //~^ ERROR unclosed HTML tag `div`
75 pub fn f() {}