Skip to content

Commit

Permalink
Improve tests
Browse files Browse the repository at this point in the history
Now this actually tests the links are generated correctly
  • Loading branch information
jyn514 committed Aug 30, 2020
1 parent e885f00 commit d715015
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/test/rustdoc/auxiliary/intra-link-pub-use.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#![crate_name = "inner"]

/// Documentation, including a link to [std::ptr]
pub fn f() {}
18 changes: 14 additions & 4 deletions src/test/rustdoc/intra-link-pub-use.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
// aux-build: intra-link-pub-use.rs
#![deny(broken_intra_doc_links)]
#![crate_name = "outer"]

extern crate inner;

/// [mod@std::env] [g]
/// [std::env] [g]
// FIXME: This can't be tested because rustdoc doesn't show documentation on pub re-exports.
// Until then, comment out the `htmldocck` test.
// This test still does something; namely check that no incorrect errors are emitted when
// documenting the re-export.

// @has intra_link_pub_use/index.html
// @has outer/index.html
// @ has - '//a[@href="https://doc.rust-lang.org/nightly/std/env/fn.var.html"]' "std::env"
// @ has - '//a[@href="../intra_link_pub_use/fn.f.html"]' "g"
// @ has - '//a[@href="../outer/fn.f.html"]' "g"
pub use f as g;

// FIXME: same as above
/// [std::env]
extern crate self as _;

pub fn f() {}
// Make sure the documentation is actually correct by documenting an inlined re-export
/// [mod@std::env]
// @has outer/fn.f.html
// @has - '//a[@href="https://doc.rust-lang.org/nightly/std/env/index.html"]' "std::env"
pub use inner::f;

0 comments on commit d715015

Please sign in to comment.