2024-01-03 15:56:10 -06:00
|
|
|
// https://github.com/rust-lang/rust/issues/55364
|
|
|
|
#![crate_name="foo"]
|
|
|
|
|
2019-10-31 02:49:54 -05:00
|
|
|
// First a module with inner documentation
|
|
|
|
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/subone/index.html
|
2019-10-31 02:49:54 -05:00
|
|
|
// These foo/bar links in the module's documentation should refer inside `subone`
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has - '//section[@id="main-content"]/details[@open=""]/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo'
|
|
|
|
//@ has - '//section[@id="main-content"]/details[@open=""]/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar'
|
2019-10-31 02:49:54 -05:00
|
|
|
pub mod subone {
|
|
|
|
//! See either [foo] or [bar].
|
|
|
|
|
|
|
|
// This should refer to subone's `bar`
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/subone/fn.foo.html
|
|
|
|
//@ has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar'
|
2019-10-31 02:49:54 -05:00
|
|
|
/// See [bar]
|
|
|
|
pub fn foo() {}
|
|
|
|
// This should refer to subone's `foo`
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/subone/fn.bar.html
|
|
|
|
//@ has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo'
|
2019-10-31 02:49:54 -05:00
|
|
|
/// See [foo]
|
|
|
|
pub fn bar() {}
|
|
|
|
}
|
|
|
|
|
|
|
|
// A module with outer documentation
|
|
|
|
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/subtwo/index.html
|
2019-10-31 02:49:54 -05:00
|
|
|
// These foo/bar links in the module's documentation should not reference inside `subtwo`
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ !has - '//section[@id="main-content"]/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo'
|
|
|
|
//@ !has - '//section[@id="main-content"]/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar'
|
2019-10-31 02:49:54 -05:00
|
|
|
// Instead it should be referencing the top level functions
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.foo.html"]' 'foo'
|
|
|
|
//@ has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.bar.html"]' 'bar'
|
2019-10-31 02:49:54 -05:00
|
|
|
// Though there should be such links later
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="item-name"]/a[@class="fn"][@href="fn.foo.html"]' 'foo'
|
|
|
|
//@ has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="item-name"]/a[@class="fn"][@href="fn.bar.html"]' 'bar'
|
2019-10-31 02:49:54 -05:00
|
|
|
/// See either [foo] or [bar].
|
|
|
|
pub mod subtwo {
|
|
|
|
|
|
|
|
// Despite the module's docs referring to the top level foo/bar,
|
|
|
|
// this should refer to subtwo's `bar`
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/subtwo/fn.foo.html
|
|
|
|
//@ has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.bar.html"]' 'bar'
|
2019-10-31 02:49:54 -05:00
|
|
|
/// See [bar]
|
|
|
|
pub fn foo() {}
|
|
|
|
// Despite the module's docs referring to the top level foo/bar,
|
|
|
|
// this should refer to subtwo's `foo`
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/subtwo/fn.bar.html
|
|
|
|
//@ has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="fn.foo.html"]' 'foo'
|
2019-10-31 02:49:54 -05:00
|
|
|
/// See [foo]
|
|
|
|
pub fn bar() {}
|
|
|
|
}
|
|
|
|
|
|
|
|
// These are the function referred to by the module above with outer docs
|
|
|
|
|
|
|
|
/// See [bar]
|
|
|
|
pub fn foo() {}
|
|
|
|
/// See [foo]
|
|
|
|
pub fn bar() {}
|
|
|
|
|
|
|
|
// This module refers to the outer foo/bar by means of `super::`
|
|
|
|
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/subthree/index.html
|
2019-10-31 02:49:54 -05:00
|
|
|
// This module should also refer to the top level foo/bar
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.foo.html"]' 'foo'
|
|
|
|
//@ has - '//section[@id="main-content"]/details/div[@class="docblock"]//a[@href="../fn.bar.html"]' 'bar'
|
2019-10-31 02:49:54 -05:00
|
|
|
pub mod subthree {
|
|
|
|
//! See either [foo][super::foo] or [bar][super::bar]
|
|
|
|
}
|
|
|
|
|
|
|
|
// Next we go *deeper* - In order to ensure it's not just "this or parent"
|
|
|
|
// we test `crate::` and a `super::super::...` chain
|
2024-06-21 07:03:08 -05:00
|
|
|
//@ has foo/subfour/subfive/subsix/subseven/subeight/index.html
|
|
|
|
//@ has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="desc docblock-short"]//a[@href="../../../../../subone/fn.foo.html"]' 'other foo'
|
|
|
|
//@ has - '//section[@id="main-content"]/ul[@class="item-table"]//div[@class="desc docblock-short"]//a[@href="../../../../../subtwo/fn.bar.html"]' 'other bar'
|
2019-10-31 02:49:54 -05:00
|
|
|
pub mod subfour {
|
|
|
|
pub mod subfive {
|
|
|
|
pub mod subsix {
|
|
|
|
pub mod subseven {
|
|
|
|
pub mod subeight {
|
|
|
|
/// See [other foo][crate::subone::foo]
|
|
|
|
pub fn foo() {}
|
|
|
|
/// See [other bar][super::super::super::super::super::subtwo::bar]
|
|
|
|
pub fn bar() {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|