Skip to content

Commit 120cf57

Browse files
committed
Add testcases for issue 76296
As well as testing the ability to override the url, run the same testcase with the `doc(html_root_url)` specified url.
1 parent b2d115f commit 120cf57

File tree

4 files changed

+74
-0
lines changed

4 files changed

+74
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// compile-flags: -C metadata=1
2+
// compile-flags: -C extra-filename=-1
3+
#![crate_name="foo"]
4+
#![doc(html_root_url="https://example.com/foo/v1")]
5+
6+
pub struct Foo1;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// compile-flags: -C metadata=2
2+
// compile-flags: -C extra-filename=-2
3+
#![crate_name = "foo"]
4+
#![doc(html_root_url="https://example.com/foo/v2")]
5+
6+
pub struct Foo2;
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// aux-build: issue-76296-1.rs
2+
// aux-build: issue-76296-2.rs
3+
// compile-flags: -Z unstable-options
4+
// compile-flags: --edition 2018
5+
// compile-flags: --extern priv:foo1={{build-base}}/issue-76296-override/auxiliary/libfoo-1.so
6+
// compile-flags: --extern priv:foo2={{build-base}}/issue-76296-override/auxiliary/libfoo-2.so
7+
// compile-flags: --extern-html-root-url foo=https://example.com/override/v1
8+
// compile-flags: --extern-html-root-url foo=https://example.com/override/v2
9+
10+
// @has 'issue_76296_override/index.html'
11+
// @matches - '//a[@href="https://example.com/override/v1/foo/struct.Foo1.html"]' '^Foo1$'
12+
// @matches - '//a[@href="https://example.com/override/v2/foo/struct.Foo2.html"]' '^Foo2$'
13+
14+
#[doc(no_inline)]
15+
pub use foo1::Foo1;
16+
17+
#[doc(no_inline)]
18+
pub use foo2::Foo2;
19+
20+
// @has 'issue_76296_override/fn.foo1.html'
21+
// @matches - '//a[@href="https://example.com/override/v1/foo/struct.Foo1.html"]' '^foo1::Foo1$'
22+
// @matches - '//a[@href="https://example.com/override/v1/foo/struct.Foo1.html"]' '^Foo1$'
23+
24+
/// Makes a [`foo1::Foo1`]
25+
pub fn foo1() -> Foo1 { foo1::Foo1 }
26+
27+
// @has 'issue_76296_override/fn.foo2.html'
28+
// @matches - '//a[@href="https://example.com/override/v2/foo/struct.Foo2.html"]' '^foo2::Foo2$'
29+
// @matches - '//a[@href="https://example.com/override/v2/foo/struct.Foo2.html"]' '^Foo2$'
30+
31+
/// Makes a [`foo2::Foo2`]
32+
pub fn foo2() -> Foo2 { foo2::Foo2 }

src/test/rustdoc/issue-76296.rs

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// aux-build: issue-76296-1.rs
2+
// aux-build: issue-76296-2.rs
3+
// compile-flags: -Z unstable-options
4+
// compile-flags: --edition 2018
5+
// compile-flags: --extern priv:foo1={{build-base}}/issue-76296/auxiliary/libfoo-1.so
6+
// compile-flags: --extern priv:foo2={{build-base}}/issue-76296/auxiliary/libfoo-2.so
7+
8+
// @has 'issue_76296/index.html'
9+
// @matches - '//a[@href="https://example.com/foo/v1/foo/struct.Foo1.html"]' '^Foo1$'
10+
// @matches - '//a[@href="https://example.com/foo/v2/foo/struct.Foo2.html"]' '^Foo2$'
11+
12+
#[doc(no_inline)]
13+
pub use foo1::Foo1;
14+
15+
#[doc(no_inline)]
16+
pub use foo2::Foo2;
17+
18+
// @has 'issue_76296/fn.foo1.html'
19+
// @matches - '//a[@href="https://example.com/foo/v1/foo/struct.Foo1.html"]' '^foo1::Foo1$'
20+
// @matches - '//a[@href="https://example.com/foo/v1/foo/struct.Foo1.html"]' '^Foo1$'
21+
22+
/// Makes a [`foo1::Foo1`]
23+
pub fn foo1() -> Foo1 { foo1::Foo1 }
24+
25+
// @has 'issue_76296/fn.foo2.html'
26+
// @matches - '//a[@href="https://example.com/foo/v2/foo/struct.Foo2.html"]' '^foo2::Foo2$'
27+
// @matches - '//a[@href="https://example.com/foo/v2/foo/struct.Foo2.html"]' '^Foo2$'
28+
29+
/// Makes a [`foo2::Foo2`]
30+
pub fn foo2() -> Foo2 { foo2::Foo2 }

0 commit comments

Comments
 (0)