Add doctest to ensure that doctests with crate-level attributes are not part of merged doctest
This commit is contained in:
parent
cbf6fe05e7
commit
7dcb841de0
22
tests/rustdoc-ui/2024-doctests-crate-attribute.rs
Normal file
22
tests/rustdoc-ui/2024-doctests-crate-attribute.rs
Normal file
@ -0,0 +1,22 @@
|
||||
//@ check-pass
|
||||
//@ compile-flags: --test --test-args=--test-threads=1 -Zunstable-options --edition 2024
|
||||
//@ normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
|
||||
//@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
|
||||
//@ normalize-stdout-test ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL"
|
||||
|
||||
/// This doctest is used to ensure that if a crate attribute is present,
|
||||
/// it will not be part of the merged doctests.
|
||||
///
|
||||
/// ```
|
||||
/// #![doc(html_playground_url = "foo")]
|
||||
///
|
||||
/// pub struct Bar;
|
||||
/// ```
|
||||
///
|
||||
/// This one will allow us to confirm that the doctest above will be a
|
||||
/// standalone one (there will be two separate doctests passes).
|
||||
///
|
||||
/// ```
|
||||
/// let x = 12;
|
||||
/// ```
|
||||
pub struct Foo;
|
12
tests/rustdoc-ui/2024-doctests-crate-attribute.stdout
Normal file
12
tests/rustdoc-ui/2024-doctests-crate-attribute.stdout
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
running 1 test
|
||||
test $DIR/2024-doctests-crate-attribute.rs - Foo (line 19) ... ok
|
||||
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||
|
||||
|
||||
running 1 test
|
||||
test $DIR/2024-doctests-crate-attribute.rs - Foo (line 10) ... ok
|
||||
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||
|
Loading…
Reference in New Issue
Block a user