Skip to content

Commit 8564496

Browse files
committed
Add regression test for remap-path-prefix handling in rustdoc for deps
1 parent 1d8f9c5 commit 8564496

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
pub struct MyStruct {
2+
field: u32,
3+
}
4+
5+
impl MyStruct {
6+
pub fn new() -> MyStruct {
7+
MyStruct { field: 3 }
8+
}
9+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
extern crate dep;
2+
3+
pub use dep::MyStruct;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
use run_make_support::{cwd, rfs, rustc, rustdoc};
2+
3+
fn main() {
4+
// 1. Let's compile the `dep` crate with some `--remap-path-prefix`
5+
rustc()
6+
.input("dep.rs")
7+
.crate_type("lib")
8+
.arg(format!("--remap-path-prefix={}=", cwd().display()))
9+
.run();
10+
11+
// 2. Let's generate the documentation for the `dep` crate
12+
// in order to have it's sources generated
13+
rustdoc().input("dep.rs").crate_type("lib").run();
14+
15+
// 3. Let's generate the documentation for the `reexport` crate
16+
// with `dep` as dependency
17+
rustdoc().input("reexport.rs").crate_type("lib").extern_("dep", "libdep.rlib").run();
18+
19+
// Let's verify that "Source" links for dep exist in `MyStruct` page
20+
let reexport_MyStruct_content = rfs::read_to_string("doc/reexport/struct.MyStruct.html");
21+
// FIXME: Those assert don't work!
22+
assert!(reexport_MyStruct_content.contains(r#""../src/dep/dep.rs.html#1">Source"#));
23+
assert!(reexport_MyStruct_content.contains(r#""../src/dep/dep.rs.html#6">Source"#));
24+
}

0 commit comments

Comments
 (0)