This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Original file line number Diff line number Diff line change 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 "wrong-ast.rs:\d+:\d+" -> "wrong-ast.rs:$$LINE:$$COL"
6+
7+ /// This one should fail: crate attributes should remain crate attributes
8+ /// in standalone doctests.
9+ ///
10+ /// ```compile_fail
11+ /// #![deny(missing_docs)]
12+ ///
13+ /// pub struct Bar;
14+ /// ```
15+ ///
16+ /// This one should not impact the other merged doctests.
17+ ///
18+ /// ```
19+ /// #![deny(unused)]
20+ /// ```
21+ ///
22+ /// ```
23+ /// let x = 12;
24+ /// ```
25+ ///
26+ /// This one should not be a merged doctest (because of `$crate`):
27+ ///
28+ /// ```
29+ /// macro_rules! bla {
30+ /// () => {{
31+ /// $crate::foo();
32+ /// }}
33+ /// }
34+ ///
35+ /// fn foo() {}
36+ ///
37+ /// fn main() {
38+ /// bla!();
39+ /// }
40+ /// ```
41+ pub struct Foo ;
Original file line number Diff line number Diff line change 1+
2+ running 2 tests
3+ test $DIR/2024-doctests-checks.rs - Foo (line 18) ... ok
4+ test $DIR/2024-doctests-checks.rs - Foo (line 22) ... ok
5+
6+ test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
7+
8+
9+ running 2 tests
10+ test $DIR/2024-doctests-checks.rs - Foo (line 10) - compile fail ... ok
11+ test $DIR/2024-doctests-checks.rs - Foo (line 28) ... ok
12+
13+ test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
14+
You can’t perform that action at this time.
0 commit comments