mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Add test cases for intra-doc links
This commit is contained in:
@@ -532,6 +532,7 @@ fn make_href(
|
||||
fqp: &[Symbol],
|
||||
is_absolute: bool,
|
||||
) -> String {
|
||||
// FIXME: relative extern URLs may break when prefixed with root_path
|
||||
if !is_absolute && let Some(root_path) = root_path {
|
||||
let root = root_path.trim_end_matches('/');
|
||||
url_parts.push_front(root);
|
||||
|
||||
+15
-3
@@ -1,4 +1,4 @@
|
||||
//@ compile-flags:-Z unstable-options --extern-html-root-url core=../ --extern-html-root-takes-precedence
|
||||
//@ compile-flags:-Z unstable-options --extern-html-root-url core=../ --extern-html-root-takes-precedence --generate-link-to-definition
|
||||
|
||||
// At depth 1 (top-level), the href should be ../core/...
|
||||
//@ has extern_html_root_url_relative/index.html
|
||||
@@ -9,7 +9,19 @@
|
||||
// At depth 2 (inside a module), the href should be ../../core/...
|
||||
pub mod nested {
|
||||
//@ has extern_html_root_url_relative/nested/index.html
|
||||
//@ has - '//a/@href' '../../core/iter/index.html'
|
||||
//@ has - '//a/@href' '../../core/future/index.html'
|
||||
#[doc(no_inline)]
|
||||
pub use std::iter;
|
||||
pub use std::future;
|
||||
}
|
||||
|
||||
// Also depth 2, but for an intra-doc link.
|
||||
//@ has extern_html_root_url_relative/intra_doc_link/index.html
|
||||
//@ has - '//a/@href' '../../core/ptr/fn.write.html'
|
||||
/// [write](<core::ptr::write()>)
|
||||
pub mod intra_doc_link {
|
||||
}
|
||||
|
||||
// link-to-definition
|
||||
//@ has src/extern_html_root_url_relative/extern-html-root-url-relative.rs.html
|
||||
//@ has - '//a/@href' '../../core/iter/index.html'
|
||||
//@ has - '//a/@href' '../../core/future/index.html'
|
||||
|
||||
Reference in New Issue
Block a user