Skip to content

Commit 5b6bd4d

Browse files
Add doctest to ensure that doctests with crate-level attributes are not part of merged doctest
1 parent 7a3780f commit 5b6bd4d

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//@ check-pass
2+
//@ compile-flags: --test --test-args=--test-threads=1 -Zunstable-options --edition 2024
3+
//@ normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
4+
//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
5+
//@ normalize-stdout-test ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL"
6+
7+
/// This doctest is used to ensure that if a crate attribute is present,
8+
/// it will not be part of the merged doctests.
9+
///
10+
/// ```
11+
/// #![doc(html_playground_url = "foo")]
12+
///
13+
/// pub struct Bar;
14+
/// ```
15+
///
16+
/// This one will allow us to confirm that the doctest above will be a
17+
/// standalone one (there will be two separate doctests passes).
18+
///
19+
/// ```
20+
/// let x = 12;
21+
/// ```
22+
pub struct Foo;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
running 1 test
3+
test $DIR/2024-doctests-crate-attribute.rs - Foo (line 19) ... ok
4+
5+
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
6+
7+
8+
running 1 test
9+
test $DIR/2024-doctests-crate-attribute.rs - Foo (line 10) ... ok
10+
11+
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
12+

0 commit comments

Comments
 (0)