Skip to content

Commit fcee70f

Browse files
Update tests
1 parent 6bbb7fd commit fcee70f

File tree

3 files changed

+43
-6
lines changed

3 files changed

+43
-6
lines changed

src/librustdoc/passes/unindent_comments/tests.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,7 @@ fn should_leave_multiple_indent_levels() {
3737

3838
#[test]
3939
fn should_ignore_first_line_indent() {
40-
// The first line of the first paragraph may not be indented as
41-
// far due to the way the doc string was written:
42-
//
43-
// #[doc = "Start way over here
44-
// and continue here"]
45-
run_test("line1\n line2", "line1\nline2");
40+
run_test("line1\n line2", "line1\n line2");
4641
}
4742

4843
#[test]

src/test/rustdoc/unindent.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Just some text.

src/test/rustdoc/unindent.rs

+41
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![feature(external_doc)]
2+
13
#![crate_name = "foo"]
24

35
// @has foo/struct.Example.html
@@ -21,3 +23,42 @@ pub struct Example;
2123
/// .build();
2224
/// ```
2325
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;

0 commit comments

Comments
 (0)