]> git.lizzy.rs Git - rust.git/commitdiff
Improve tests
authorJoshua Nelson <jyn514@gmail.com>
Sun, 30 Aug 2020 16:06:40 +0000 (12:06 -0400)
committerJoshua Nelson <jyn514@gmail.com>
Sun, 30 Aug 2020 16:06:40 +0000 (12:06 -0400)
Now this actually tests the links are generated correctly

src/test/rustdoc/auxiliary/intra-link-pub-use.rs [new file with mode: 0644]
src/test/rustdoc/intra-link-pub-use.rs

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 (file)
index 0000000..a4db2ff
--- /dev/null
@@ -0,0 +1,4 @@
+#![crate_name = "inner"]
+
+/// Documentation, including a link to [std::ptr]
+pub fn f() {}
index f49edea410d73ee628d525e667dd23afe8699812..dd52249abc6d0ad27cab524bd0c82325ba7fa7e5 100644 (file)
@@ -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;