mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Add 2024 edition doctests to cover corner cases
This commit is contained in:
parent
14f80f9e69
commit
84d9b67dab
41
tests/rustdoc-ui/2024-doctests-checks.rs
Normal file
41
tests/rustdoc-ui/2024-doctests-checks.rs
Normal file
@ -0,0 +1,41 @@
|
||||
//@ 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 "wrong-ast.rs:\d+:\d+" -> "wrong-ast.rs:$$LINE:$$COL"
|
||||
|
||||
/// This one should fail: crate attributes should remain crate attributes
|
||||
/// in standalone doctests.
|
||||
///
|
||||
/// ```compile_fail
|
||||
/// #![deny(missing_docs)]
|
||||
///
|
||||
/// pub struct Bar;
|
||||
/// ```
|
||||
///
|
||||
/// This one should not impact the other merged doctests.
|
||||
///
|
||||
/// ```
|
||||
/// #![deny(unused)]
|
||||
/// ```
|
||||
///
|
||||
/// ```
|
||||
/// let x = 12;
|
||||
/// ```
|
||||
///
|
||||
/// This one should not be a merged doctest (because of `$crate`):
|
||||
///
|
||||
/// ```
|
||||
/// macro_rules! bla {
|
||||
/// () => {{
|
||||
/// $crate::foo();
|
||||
/// }}
|
||||
/// }
|
||||
///
|
||||
/// fn foo() {}
|
||||
///
|
||||
/// fn main() {
|
||||
/// bla!();
|
||||
/// }
|
||||
/// ```
|
||||
pub struct Foo;
|
14
tests/rustdoc-ui/2024-doctests-checks.stdout
Normal file
14
tests/rustdoc-ui/2024-doctests-checks.stdout
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
running 2 tests
|
||||
test $DIR/2024-doctests-checks.rs - Foo (line 18) ... ok
|
||||
test $DIR/2024-doctests-checks.rs - Foo (line 22) ... ok
|
||||
|
||||
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||
|
||||
|
||||
running 2 tests
|
||||
test $DIR/2024-doctests-checks.rs - Foo (line 10) - compile fail ... ok
|
||||
test $DIR/2024-doctests-checks.rs - Foo (line 28) ... ok
|
||||
|
||||
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
|
||||
|
Loading…
Reference in New Issue
Block a user