summaryrefslogtreecommitdiffstats
path: root/src/test/rustdoc-ui/invalid-html-tags.rs
blob: 317f1fd1d46411a54c72db058aff165868ada5ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#![deny(rustdoc::invalid_html_tags)]

//! <p>💩<p>
//~^ ERROR unclosed HTML tag `p`
//~^^ ERROR unclosed HTML tag `p`

/// <img><input>
/// <script>
/// <img><input>
/// </script>
/// <unknown>
//~^ ERROR unclosed HTML tag `unknown`
/// < ok
/// <script>
//~^ ERROR unclosed HTML tag `script`
pub fn foo() {}

/// <h1>
///   <h2>
//~^ ERROR unclosed HTML tag `h2`
///     <h3>
//~^ ERROR unclosed HTML tag `h3`
/// </h1>
/// </hello>
//~^ ERROR unopened HTML tag `hello`
pub fn bar() {}

/// <div>
///    <br/> <p>
//~^ ERROR unclosed HTML tag `p`
/// </div>
pub fn a() {}

/// <div>
///   <p>
///      <div></div>
///   </p>
/// </div>
pub fn b() {}

/// <div style="hello">
//~^ ERROR unclosed HTML tag `div`
///   <h3>
//~^ ERROR unclosed HTML tag `h3`
/// <script
//~^ ERROR unclosed HTML tag `script`
pub fn c() {}

// Unclosed tags shouldn't warn if they are nested inside a <script> elem.
/// <script>
///   <h3><div>
/// </script>
/// <script>
///   <div>
///     <p>
///   </div>
/// </script>
pub fn d() {}

// Unclosed tags shouldn't warn if they are nested inside a <style> elem.
/// <style>
///   <h3><div>
/// </style>
/// <stYle>
///   <div>
///     <p>
///   </div>
/// </style>
pub fn e() {}

// Closing tags need to have ">" at the end, otherwise it's not a closing tag!
/// <div></div >
/// <div></div
//~^ ERROR unclosed HTML tag `div`
pub fn f() {}

/// <!---->
/// <!-- -->
/// <!-- <div> -->
/// <!-- <!-- -->
pub fn g() {}

/// <!--
/// -->
pub fn h() {}

/// <!--
//~^ ERROR Unclosed HTML comment
pub fn i() {}

/// hello
///
/// ```
/// uiapp.run(&env::args().collect::<Vec<_>>());
/// ```
pub fn j() {}

// Check that nested codeblocks are working as well
/// hello
///
/// ``````markdown
/// normal markdown
///
/// ```
/// uiapp.run(&env::args().collect::<Vec<_>>());
/// ```
///
/// <Vec<_> shouldn't warn!
/// ``````
pub fn k() {}

/// Web Components style <dashed-tags>
//~^ ERROR unclosed HTML tag `dashed-tags`
/// Web Components style </unopened-tag>
//~^ ERROR unopened HTML tag `unopened-tag`
pub fn m() {}

/// backslashed \<a href="">
pub fn no_error_1() {}

/// backslashed \<<a href="">
//~^ ERROR unclosed HTML tag `a`
pub fn p() {}