about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoshua Nelson <jyn514@gmail.com>2020-08-30 12:06:40 -0400
committerJoshua Nelson <jyn514@gmail.com>2020-08-30 12:06:40 -0400
commitd7150154fa5c35c0b570570f156ba3a5cc6dfb1d (patch)
tree8a2ed9d3cb2ece50720f7ac157b7dcfcc1dd8b63
parente885f00f24aab657b3a9835818fc96e638e7fb21 (diff)
downloadrust-d7150154fa5c35c0b570570f156ba3a5cc6dfb1d.tar.gz
rust-d7150154fa5c35c0b570570f156ba3a5cc6dfb1d.zip
Improve tests
Now this actually tests the links are generated correctly
-rw-r--r--src/test/rustdoc/auxiliary/intra-link-pub-use.rs4
-rw-r--r--src/test/rustdoc/intra-link-pub-use.rs18
2 files changed, 18 insertions, 4 deletions
diff --git a/src/test/rustdoc/auxiliary/intra-link-pub-use.rs b/src/test/rustdoc/auxiliary/intra-link-pub-use.rs
new file mode 100644
index 00000000000..a4db2ffc445
--- /dev/null
+++ b/src/test/rustdoc/auxiliary/intra-link-pub-use.rs
@@ -0,0 +1,4 @@
+#![crate_name = "inner"]
+
+/// Documentation, including a link to [std::ptr]
+pub fn f() {}
diff --git a/src/test/rustdoc/intra-link-pub-use.rs b/src/test/rustdoc/intra-link-pub-use.rs
index f49edea410d..dd52249abc6 100644
--- a/src/test/rustdoc/intra-link-pub-use.rs
+++ b/src/test/rustdoc/intra-link-pub-use.rs
@@ -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;