]> git.lizzy.rs Git - rust.git/blob - tests/ui/doc.rs
rustup and compile-fail -> ui test move
[rust.git] / tests / ui / doc.rs
1 //! This file tests for the DOC_MARKDOWN lint
2 //~^ ERROR: you should put `DOC_MARKDOWN` between ticks
3
4 #![feature(plugin)]
5 #![plugin(clippy)]
6
7 #![deny(doc_markdown)]
8
9 /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
10 //~^ ERROR: you should put `foo_bar` between ticks
11 //~| ERROR: you should put `foo::bar` between ticks
12 /// Markdown is _weird_. I mean _really weird_.  This \_ is ok. So is `_`. But not Foo::some_fun
13 //~^ ERROR: you should put `Foo::some_fun` between ticks
14 /// which should be reported only once despite being __doubly bad__.
15 /// Here be ::is::a::global:path.
16 //~^ ERROR: you should put `is::a::global:path` between ticks
17 /// That's not code ~NotInCodeBlock~.
18 //~^ ERROR: you should put `NotInCodeBlock` between ticks
19 /// be_sure_we_got_to_the_end_of_it
20 //~^ ERROR: you should put `be_sure_we_got_to_the_end_of_it` between ticks
21 fn foo_bar() {
22 }
23
24 /// That one tests multiline ticks.
25 /// ```rust
26 /// foo_bar FOO_BAR
27 /// _foo bar_
28 /// ```
29 ///
30 /// ~~~rust
31 /// foo_bar FOO_BAR
32 /// _foo bar_
33 /// ~~~
34 /// be_sure_we_got_to_the_end_of_it
35 //~^ ERROR: you should put `be_sure_we_got_to_the_end_of_it` between ticks
36 fn multiline_codeblock() {
37 }
38
39 /// This _is a test for
40 /// multiline
41 /// emphasis_.
42 /// be_sure_we_got_to_the_end_of_it
43 //~^ ERROR: you should put `be_sure_we_got_to_the_end_of_it` between ticks
44 fn test_emphasis() {
45 }
46
47 /// This tests units. See also #835.
48 /// kiB MiB GiB TiB PiB EiB
49 /// kib Mib Gib Tib Pib Eib
50 /// kB MB GB TB PB EB
51 /// kb Mb Gb Tb Pb Eb
52 /// 32kiB 32MiB 32GiB 32TiB 32PiB 32EiB
53 /// 32kib 32Mib 32Gib 32Tib 32Pib 32Eib
54 /// 32kB 32MB 32GB 32TB 32PB 32EB
55 /// 32kb 32Mb 32Gb 32Tb 32Pb 32Eb
56 /// NaN
57 /// be_sure_we_got_to_the_end_of_it
58 //~^ ERROR: you should put `be_sure_we_got_to_the_end_of_it` between ticks
59 fn test_units() {
60 }
61
62 /// This one checks we don’t try to split unicode codepoints
63 /// `ß`
64 /// `ℝ`
65 /// `💣`
66 /// `❤️`
67 /// ß_foo
68 //~^ ERROR: you should put `ß_foo` between ticks
69 /// ℝ_foo
70 //~^ ERROR: you should put `ℝ_foo` between ticks
71 /// 💣_foo
72 /// ❤️_foo
73 /// foo_ß
74 //~^ ERROR: you should put `foo_ß` between ticks
75 /// foo_ℝ
76 //~^ ERROR: you should put `foo_ℝ` between ticks
77 /// foo_💣
78 /// foo_❤️
79 /// [ßdummy textß][foo_1ß]
80 /// [ℝdummy textℝ][foo_2ℝ]
81 /// [💣dummy tex💣t][foo3_💣]
82 /// [❤️dummy text❤️][foo_4❤️]
83 /// [ßdummy textß](foo_5ß)
84 /// [ℝdummy textℝ](foo_6ℝ)
85 /// [💣dummy tex💣t](fo7o_💣)
86 /// [❤️dummy text❤️](foo_8❤️)
87 /// [foo1_ß]: dummy text
88 /// [foo2_ℝ]: dummy text
89 /// [foo3_💣]: dummy text
90 /// [foo4_❤️]: dummy text
91 /// be_sure_we_got_to_the_end_of_it
92 //~^ ERROR: you should put `be_sure_we_got_to_the_end_of_it` between ticks
93 fn test_unicode() {
94 }
95
96 /// This test has [a link_with_underscores][chunked-example] inside it. See #823.
97 //~^ ERROR: you should put `link_with_underscores` between ticks
98 /// See also [the issue tracker](https://github.com/Manishearth/rust-clippy/search?q=doc_markdown&type=Issues)
99 /// on GitHub (which is a camel-cased word, but is OK). And here is another [inline link][inline_link].
100 /// It can also be [inline_link2].
101 //~^ ERROR: you should put `inline_link2` between ticks
102 ///
103 /// [chunked-example]: https://en.wikipedia.org/wiki/Chunked_transfer_encoding#Example
104 /// [inline_link]: https://foobar
105 /// [inline_link2]: https://foobar
106
107 /// The `main` function is the entry point of the program. Here it only calls the `foo_bar` and
108 /// `multiline_ticks` functions.
109 ///
110 /// expression of the type  `_ <bit_op> m <cmp_op> c` (where `<bit_op>`
111 /// is one of {`&`, '|'} and `<cmp_op>` is one of {`!=`, `>=`, `>` ,
112 /// be_sure_we_got_to_the_end_of_it
113 //~^ ERROR: you should put `be_sure_we_got_to_the_end_of_it` between ticks
114 fn main() {
115     foo_bar();
116     multiline_codeblock();
117     test_emphasis();
118     test_units();
119 }
120
121 /// ## CamelCaseThing
122 /// Talks about `CamelCaseThing`. Titles should be ignored, see issue #897.
123 ///
124 /// # CamelCaseThing
125 ///
126 /// Not a title #897 CamelCaseThing
127 //~^ ERROR: you should put `CamelCaseThing` between ticks
128 /// be_sure_we_got_to_the_end_of_it
129 //~^ ERROR: you should put `be_sure_we_got_to_the_end_of_it` between ticks
130 fn issue897() {
131 }
132
133 /// I am confused by brackets? (`x_y`)
134 /// I am confused by brackets? (foo `x_y`)
135 /// I am confused by brackets? (`x_y` foo)
136 /// be_sure_we_got_to_the_end_of_it
137 //~^ ERROR: you should put `be_sure_we_got_to_the_end_of_it` between ticks
138 fn issue900() {
139 }
140
141 /// Diesel queries also have a similar problem to [Iterator][iterator], where
142 /// /// More talking
143 /// returning them from a function requires exposing the implementation of that
144 /// function. The [`helper_types`][helper_types] module exists to help with this,
145 /// but you might want to hide the return type or have it conditionally change.
146 /// Boxing can achieve both.
147 ///
148 /// [iterator]: https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html
149 /// [helper_types]: ../helper_types/index.html
150 /// be_sure_we_got_to_the_end_of_it
151 //~^ ERROR: you should put `be_sure_we_got_to_the_end_of_it` between ticks
152 fn issue883() {
153 }
154
155 /// `foo_bar
156 /// baz_quz`
157 /// [foo
158 /// bar](https://doc.rust-lang.org/stable/std/iter/trait.IteratorFooBar.html)
159 fn multiline() {
160 }
161
162 /** E.g. serialization of an empty list: FooBar
163 ```
164 That's in a code block: `PackedNode`
165 ```
166
167 And BarQuz too.
168 be_sure_we_got_to_the_end_of_it
169 */
170 //~^^^^^^^^ ERROR: you should put `FooBar` between ticks
171 //~^^^^ ERROR: you should put `BarQuz` between ticks
172 //~^^^^ ERROR: you should put `be_sure_we_got_to_the_end_of_it` between ticks
173 fn issue1073() {
174 }
175
176 /** E.g. serialization of an empty list: FooBar
177 ```
178 That's in a code block: PackedNode
179 ```
180
181 And BarQuz too.
182 be_sure_we_got_to_the_end_of_it
183 */
184 //~^^^^^^^^ ERROR: you should put `FooBar` between ticks
185 //~^^^^ ERROR: you should put `BarQuz` between ticks
186 //~^^^^ ERROR: you should put `be_sure_we_got_to_the_end_of_it` between ticks
187 fn issue1073_alt() {
188 }
189
190 /// Test more than three quotes:
191 /// ````
192 /// DoNotWarn
193 /// ```
194 /// StillDont
195 /// ````
196 /// be_sure_we_got_to_the_end_of_it
197 //~^ ERROR: you should put `be_sure_we_got_to_the_end_of_it` between ticks
198 fn four_quotes() {
199 }