Add regression tests for mistyped standalone-crate attribute

This commit is contained in:
Guillaume Gomez 2024-09-27 21:40:11 +02:00
parent 0956f69caf
commit 84d41e2fc1
3 changed files with 64 additions and 0 deletions

View File

@ -0,0 +1,16 @@
// This test checks that it will output warnings for usage of `standalone` or `standalone_crate`.
//@ compile-flags:--test -Zunstable-options --edition 2024
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ normalize-stdout-test: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL"
#![deny(warnings)]
//! ```standalone
//! bla
//! ```
//!
//! ```standalone_crate
//! bla
//! ```

View File

@ -0,0 +1,38 @@
error: unknown attribute `standalone`
--> $DIR/standalone-warning-2024.rs:10:1
|
10 | / //! ```standalone
11 | | //! bla
12 | | //! ```
13 | | //!
14 | | //! ```standalone_crate
15 | | //! bla
16 | | //! ```
| |_______^
|
= help: there is an attribute with a similar name: `standalone-crate`
= help: the code block will either not be tested if not marked as a rust one or the code will be run as part of the merged doctests if compatible
note: the lint level is defined here
--> $DIR/standalone-warning-2024.rs:8:9
|
8 | #![deny(warnings)]
| ^^^^^^^^
= note: `#[deny(rustdoc::invalid_codeblock_attributes)]` implied by `#[deny(warnings)]`
error: unknown attribute `standalone_crate`
--> $DIR/standalone-warning-2024.rs:10:1
|
10 | / //! ```standalone
11 | | //! bla
12 | | //! ```
13 | | //!
14 | | //! ```standalone_crate
15 | | //! bla
16 | | //! ```
| |_______^
|
= help: there is an attribute with a similar name: `standalone-crate`
= help: the code block will either not be tested if not marked as a rust one or the code will be run as part of the merged doctests if compatible
error: aborting due to 2 previous errors

View File

@ -0,0 +1,10 @@
// This test checks that it will not output warning for usage of `standalone` or `standalone_crate`.
//@ check-pass
//! ```standalone
//! bla
//! ```
//!
//! ```standalone_crate
//! bla
//! ```