mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 14:01:51 +00:00
Update tests
This commit is contained in:
parent
1f7bce012d
commit
b5a41418f8
@ -1,4 +1,4 @@
|
||||
error: missing documentation for macro
|
||||
error: missing documentation for a macro
|
||||
--> $DIR/deny-missing-docs-macro.rs:6:1
|
||||
|
|
||||
LL | macro_rules! foo {
|
||||
|
23
src/test/rustdoc/macro-document-private-duplicate.rs
Normal file
23
src/test/rustdoc/macro-document-private-duplicate.rs
Normal file
@ -0,0 +1,23 @@
|
||||
// FIXME: If two macros in the same module have the same name
|
||||
// (yes, that's a thing), rustdoc lists both of them on the index page,
|
||||
// but only documents the first one on the page for the macro.
|
||||
// Fortunately, this can only happen in document private items mode,
|
||||
// but it still isn't ideal beahvior.
|
||||
//
|
||||
// See https://github.com/rust-lang/rust/pull/88019#discussion_r693920453
|
||||
//
|
||||
// compile-flags: --document-private-items
|
||||
|
||||
// @has macro_document_private_duplicate/index.html 'Doc 1.'
|
||||
// @has macro_document_private_duplicate/macro.a_macro.html 'Doc 1.'
|
||||
/// Doc 1.
|
||||
macro_rules! a_macro {
|
||||
() => ()
|
||||
}
|
||||
|
||||
// @has macro_document_private_duplicate/index.html 'Doc 2.'
|
||||
// @!has macro_document_private_duplicate/macro.a_macro.html 'Doc 2.'
|
||||
/// Doc 2.
|
||||
macro_rules! a_macro {
|
||||
() => ()
|
||||
}
|
19
src/test/rustdoc/macro-document-private.rs
Normal file
19
src/test/rustdoc/macro-document-private.rs
Normal file
@ -0,0 +1,19 @@
|
||||
// Checks that private macros are documented when `--document-private-items`
|
||||
// is present.
|
||||
//
|
||||
// This is a regression test for issue #73754.
|
||||
//
|
||||
// compile-flags: --document-private-items
|
||||
|
||||
#![feature(decl_macro)]
|
||||
|
||||
|
||||
// @has macro_document_private/macro.some_macro.html
|
||||
macro some_macro {
|
||||
(a: tt) => {}
|
||||
}
|
||||
|
||||
// @has macro_document_private/macro.another_macro.html
|
||||
macro_rules! another_macro {
|
||||
(a: tt) => {}
|
||||
}
|
16
src/test/rustdoc/macro-indirect-use.rs
Normal file
16
src/test/rustdoc/macro-indirect-use.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// Checks that it is possible to make a macro public through a `pub use` of its
|
||||
// parent module.
|
||||
//
|
||||
// This is a regression test for issue #87257.
|
||||
|
||||
#![feature(decl_macro)]
|
||||
|
||||
mod outer {
|
||||
pub mod inner {
|
||||
pub macro some_macro() {}
|
||||
}
|
||||
}
|
||||
|
||||
// @has macro_indirect_use/inner/index.html
|
||||
// @has macro_indirect_use/inner/macro.some_macro.html
|
||||
pub use outer::inner;
|
17
src/test/ui/lint/lint-level-macro-def-mod.rs
Normal file
17
src/test/ui/lint/lint-level-macro-def-mod.rs
Normal file
@ -0,0 +1,17 @@
|
||||
// This checks that exported macros lint as part of their module of origin, not
|
||||
// the root module.
|
||||
//
|
||||
// check-pass
|
||||
|
||||
//! Top level documentation
|
||||
#![deny(missing_docs)]
|
||||
|
||||
#[allow(missing_docs)]
|
||||
mod module {
|
||||
#[macro_export]
|
||||
macro_rules! hello {
|
||||
() => ()
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
17
src/test/ui/lint/lint-level-macro-def.rs
Normal file
17
src/test/ui/lint/lint-level-macro-def.rs
Normal file
@ -0,0 +1,17 @@
|
||||
// Checks that you can set a lint level specficially for a macro definition.
|
||||
//
|
||||
// This is a regression test for issue #59306.
|
||||
//
|
||||
// check-pass
|
||||
|
||||
|
||||
#[deny(missing_docs)]
|
||||
mod module {
|
||||
#[allow(missing_docs)]
|
||||
#[macro_export]
|
||||
macro_rules! hello {
|
||||
() => ()
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -29,13 +29,13 @@ mod submodule {
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! exported_to_top_level {
|
||||
//~^ ERROR missing documentation for macro
|
||||
//~^ ERROR missing documentation for a macro
|
||||
() => ()
|
||||
}
|
||||
}
|
||||
|
||||
pub macro top_level_pub_macro {
|
||||
//~^ ERROR missing documentation for macro
|
||||
//~^ ERROR missing documentation for a macro
|
||||
() => ()
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: missing documentation for macro
|
||||
error: missing documentation for a macro
|
||||
--> $DIR/missing-doc-private-macro.rs:31:5
|
||||
|
|
||||
LL | macro_rules! exported_to_top_level {
|
||||
@ -10,7 +10,7 @@ note: the lint level is defined here
|
||||
LL | #![deny(missing_docs)]
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: missing documentation for macro
|
||||
error: missing documentation for a macro
|
||||
--> $DIR/missing-doc-private-macro.rs:37:1
|
||||
|
|
||||
LL | pub macro top_level_pub_macro {
|
||||
|
@ -1,7 +1,8 @@
|
||||
// run-pass
|
||||
// aux-build:unstable-macros.rs
|
||||
|
||||
#![feature(unstable_macros, local_unstable)]
|
||||
#![unstable(feature = "one_two_three_testing", issue = "none")]
|
||||
#![feature(staged_api, unstable_macros, local_unstable)]
|
||||
|
||||
#[macro_use] extern crate unstable_macros;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user