Skip to content

Commit f461118

Browse files
Add regression tests for mistyped standalone-crate attribute
1 parent 5d170f3 commit f461118

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// This test checks that it will output warnings for usage of `standalone` or `standalone_crate`.
2+
3+
//@ compile-flags:--test -Zunstable-options --edition 2024
4+
//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
5+
//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME"
6+
//@ normalize-stdout-test: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL"
7+
8+
#![deny(warnings)]
9+
10+
//! ```standalone
11+
//! bla
12+
//! ```
13+
//!
14+
//! ```standalone_crate
15+
//! bla
16+
//! ```
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
error: unknown attribute `standalone`
2+
--> $DIR/standalone-warning-2024.rs:10:1
3+
|
4+
10 | / //! ```standalone
5+
11 | | //! bla
6+
12 | | //! ```
7+
13 | | //!
8+
14 | | //! ```standalone_crate
9+
15 | | //! bla
10+
16 | | //! ```
11+
| |_______^
12+
|
13+
= help: there is an attribute with a similar name: `standalone-crate`
14+
= 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
15+
note: the lint level is defined here
16+
--> $DIR/standalone-warning-2024.rs:8:9
17+
|
18+
8 | #![deny(warnings)]
19+
| ^^^^^^^^
20+
= note: `#[deny(rustdoc::invalid_codeblock_attributes)]` implied by `#[deny(warnings)]`
21+
22+
error: unknown attribute `standalone_crate`
23+
--> $DIR/standalone-warning-2024.rs:10:1
24+
|
25+
10 | / //! ```standalone
26+
11 | | //! bla
27+
12 | | //! ```
28+
13 | | //!
29+
14 | | //! ```standalone_crate
30+
15 | | //! bla
31+
16 | | //! ```
32+
| |_______^
33+
|
34+
= help: there is an attribute with a similar name: `standalone-crate`
35+
= 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
36+
37+
error: aborting due to 2 previous errors
38+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// This test checks that it will not output warning for usage of `standalone` or `standalone_crate`.
2+
//@ check-pass
3+
4+
//! ```standalone
5+
//! bla
6+
//! ```
7+
//!
8+
//! ```standalone_crate
9+
//! bla
10+
//! ```

0 commit comments

Comments
 (0)