Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
inquisitivecrystal committed Aug 28, 2021
1 parent 1f7bce0 commit b5a4141
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/test/rustdoc-ui/deny-missing-docs-macro.stderr
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
23 changes: 23 additions & 0 deletions src/test/rustdoc/macro-document-private-duplicate.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 19 additions & 0 deletions src/test/rustdoc/macro-document-private.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 16 additions & 0 deletions src/test/rustdoc/macro-indirect-use.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 17 additions & 0 deletions src/test/ui/lint/lint-level-macro-def-mod.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 17 additions & 0 deletions src/test/ui/lint/lint-level-macro-def.rs
Original file line number Diff line number Diff line change
@@ -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() {}
4 changes: 2 additions & 2 deletions src/test/ui/lint/missing-doc-private-macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
() => ()
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/lint/missing-doc-private-macro.stderr
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion src/test/ui/macros/macro-stability-rpass.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down

0 comments on commit b5a4141

Please sign in to comment.