]> git.lizzy.rs Git - rust.git/blob - tests/rustdoc-ui/invalid-html-tags.rs
Merge commit '7d53619064ab7045c383644cb445052d2a3d46db' into sync_cg_clif-2023-02-09
[rust.git] / tests / rustdoc-ui / invalid-html-tags.rs
1 #![deny(rustdoc::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() {}
76
77 /// <!---->
78 /// <!-- -->
79 /// <!-- <div> -->
80 /// <!-- <!-- -->
81 pub fn g() {}
82
83 /// <!--
84 /// -->
85 pub fn h() {}
86
87 /// <!--
88 //~^ ERROR Unclosed HTML comment
89 pub fn i() {}
90
91 /// hello
92 ///
93 /// ```
94 /// uiapp.run(&env::args().collect::<Vec<_>>());
95 /// ```
96 pub fn j() {}
97
98 // Check that nested codeblocks are working as well
99 /// hello
100 ///
101 /// ``````markdown
102 /// normal markdown
103 ///
104 /// ```
105 /// uiapp.run(&env::args().collect::<Vec<_>>());
106 /// ```
107 ///
108 /// <Vec<_> shouldn't warn!
109 /// ``````
110 pub fn k() {}
111
112 /// Web Components style <dashed-tags>
113 //~^ ERROR unclosed HTML tag `dashed-tags`
114 /// Web Components style </unopened-tag>
115 //~^ ERROR unopened HTML tag `unopened-tag`
116 pub fn m() {}
117
118 /// backslashed \<a href="">
119 pub fn no_error_1() {}
120
121 /// backslashed \<<a href="">
122 //~^ ERROR unclosed HTML tag `a`
123 pub fn p() {}