mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 23:12:02 +00:00
Add tests for rustdoc --check option
This commit is contained in:
parent
a51b13042e
commit
5e154fae92
10
src/test/rustdoc-ui/check-fail.rs
Normal file
10
src/test/rustdoc-ui/check-fail.rs
Normal file
@ -0,0 +1,10 @@
|
||||
// compile-flags: -Z unstable-options --check
|
||||
|
||||
#![deny(missing_docs)]
|
||||
//~^ ERROR
|
||||
//~^^ ERROR
|
||||
#![deny(rustdoc)]
|
||||
|
||||
pub fn foo() {}
|
||||
//~^ ERROR
|
||||
//~^^ ERROR
|
49
src/test/rustdoc-ui/check-fail.stderr
Normal file
49
src/test/rustdoc-ui/check-fail.stderr
Normal file
@ -0,0 +1,49 @@
|
||||
error: missing documentation for the crate
|
||||
--> $DIR/check-fail.rs:3:1
|
||||
|
|
||||
LL | / #![deny(missing_docs)]
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | #![deny(rustdoc)]
|
||||
LL | |
|
||||
LL | | pub fn foo() {}
|
||||
| |_______________^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/check-fail.rs:3:9
|
||||
|
|
||||
LL | #![deny(missing_docs)]
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: missing documentation for a function
|
||||
--> $DIR/check-fail.rs:8:1
|
||||
|
|
||||
LL | pub fn foo() {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: missing code example in this documentation
|
||||
--> $DIR/check-fail.rs:3:1
|
||||
|
|
||||
LL | / #![deny(missing_docs)]
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | #![deny(rustdoc)]
|
||||
LL | |
|
||||
LL | | pub fn foo() {}
|
||||
| |_______________^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/check-fail.rs:6:9
|
||||
|
|
||||
LL | #![deny(rustdoc)]
|
||||
| ^^^^^^^
|
||||
= note: `#[deny(missing_doc_code_examples)]` implied by `#[deny(rustdoc)]`
|
||||
|
||||
error: missing code example in this documentation
|
||||
--> $DIR/check-fail.rs:8:1
|
||||
|
|
||||
LL | pub fn foo() {}
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
11
src/test/rustdoc-ui/check.rs
Normal file
11
src/test/rustdoc-ui/check.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// check-pass
|
||||
// compile-flags: -Z unstable-options --check
|
||||
|
||||
#![warn(missing_docs)]
|
||||
//~^ WARN
|
||||
//~^^ WARN
|
||||
#![warn(rustdoc)]
|
||||
|
||||
pub fn foo() {}
|
||||
//~^ WARN
|
||||
//~^^ WARN
|
49
src/test/rustdoc-ui/check.stderr
Normal file
49
src/test/rustdoc-ui/check.stderr
Normal file
@ -0,0 +1,49 @@
|
||||
warning: missing documentation for the crate
|
||||
--> $DIR/check.rs:4:1
|
||||
|
|
||||
LL | / #![warn(missing_docs)]
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | #![warn(rustdoc)]
|
||||
LL | |
|
||||
LL | | pub fn foo() {}
|
||||
| |_______________^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/check.rs:4:9
|
||||
|
|
||||
LL | #![warn(missing_docs)]
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
warning: missing documentation for a function
|
||||
--> $DIR/check.rs:9:1
|
||||
|
|
||||
LL | pub fn foo() {}
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
warning: missing code example in this documentation
|
||||
--> $DIR/check.rs:4:1
|
||||
|
|
||||
LL | / #![warn(missing_docs)]
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | #![warn(rustdoc)]
|
||||
LL | |
|
||||
LL | | pub fn foo() {}
|
||||
| |_______________^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/check.rs:7:9
|
||||
|
|
||||
LL | #![warn(rustdoc)]
|
||||
| ^^^^^^^
|
||||
= note: `#[warn(missing_doc_code_examples)]` implied by `#[warn(rustdoc)]`
|
||||
|
||||
warning: missing code example in this documentation
|
||||
--> $DIR/check.rs:9:1
|
||||
|
|
||||
LL | pub fn foo() {}
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
warning: 4 warnings emitted
|
||||
|
5
src/test/rustdoc/check.rs
Normal file
5
src/test/rustdoc/check.rs
Normal file
@ -0,0 +1,5 @@
|
||||
// compile-flags: -Z unstable-options --check
|
||||
|
||||
// @!has check/fn.foo.html
|
||||
// @!has check/index.html
|
||||
pub fn foo() {}
|
Loading…
Reference in New Issue
Block a user