Add tests for rustdoc --check option

This commit is contained in:
Guillaume Gomez 2020-11-12 14:58:07 +01:00
parent a51b13042e
commit 5e154fae92
5 changed files with 124 additions and 0 deletions

View File

@ -0,0 +1,10 @@
// compile-flags: -Z unstable-options --check
#![deny(missing_docs)]
//~^ ERROR
//~^^ ERROR
#![deny(rustdoc)]
pub fn foo() {}
//~^ ERROR
//~^^ ERROR

View 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

View 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

View 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

View File

@ -0,0 +1,5 @@
// compile-flags: -Z unstable-options --check
// @!has check/fn.foo.html
// @!has check/index.html
pub fn foo() {}