]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/unindent.rs
Rollup merge of #82484 - bugadani:docfix, r=jyn514
[rust.git] / src / test / rustdoc / unindent.rs
1 #![feature(external_doc)]
2
3 #![crate_name = "foo"]
4
5 // @has foo/struct.Example.html
6 // @matches - '//pre[@class="rust rust-example-rendered"]' \
7 //     '(?m)let example = Example::new\(\)\n    \.first\(\)\n    \.second\(\)\n    \.build\(\);\Z'
8 /// ```rust
9 /// let example = Example::new()
10 ///     .first()
11 #[cfg_attr(not(feature = "one"), doc = "    .second()")]
12 ///     .build();
13 /// ```
14 pub struct Example;
15
16 // @has foo/struct.F.html
17 // @matches - '//pre[@class="rust rust-example-rendered"]' \
18 //     '(?m)let example = Example::new\(\)\n    \.first\(\)\n    \.another\(\)\n    \.build\(\);\Z'
19 ///```rust
20 ///let example = Example::new()
21 ///    .first()
22 #[cfg_attr(not(feature = "one"), doc = "    .another()")]
23 ///    .build();
24 /// ```
25 pub struct F;
26
27 // @has foo/struct.G.html
28 // @matches - '//pre[@class="rust rust-example-rendered"]' \
29 //     '(?m)let example = Example::new\(\)\n\.first\(\)\n    \.another\(\)\n\.build\(\);\Z'
30 ///```rust
31 ///let example = Example::new()
32 ///.first()
33 #[cfg_attr(not(feature = "one"), doc = "    .another()")]
34 ///.build();
35 ///```
36 pub struct G;
37
38 // @has foo/struct.H.html
39 // @has - '//div[@class="docblock"]/p' 'no whitespace lol'
40 ///no whitespace
41 #[doc = " lol"]
42 pub struct H;
43
44 // @has foo/struct.I.html
45 // @matches - '//pre[@class="rust rust-example-rendered"]' '(?m)4 whitespaces!\Z'
46 ///     4 whitespaces!
47 #[doc = "something"]
48 pub struct I;
49
50 // @has foo/struct.J.html
51 // @matches - '//div[@class="docblock"]/p' '(?m)a\nno whitespace\nJust some text.\Z'
52 ///a
53 ///no whitespace
54 #[doc(include = "unindent.md")]
55 pub struct J;
56
57 // @has foo/struct.K.html
58 // @matches - '//pre[@class="rust rust-example-rendered"]' '(?m)4 whitespaces!\Z'
59 ///a
60 ///
61 ///    4 whitespaces!
62 ///
63 #[doc(include = "unindent.md")]
64 pub struct K;