|
| 1 | +// ignore-tidy-linelength |
| 2 | + |
| 3 | +// First a module with inner documentation |
| 4 | + |
| 5 | +// @has issue_55364/subone/index.html |
| 6 | +// These foo/bar links in the module's documentation should refer inside `subone` |
| 7 | +// @has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/subone/fn.foo.html"]' 'foo' |
| 8 | +// @has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/subone/fn.bar.html"]' 'bar' |
| 9 | +pub mod subone { |
| 10 | + //! See either [foo] or [bar]. |
| 11 | +
|
| 12 | + // This should refer to subone's `bar` |
| 13 | + // @has issue_55364/subone/fn.foo.html |
| 14 | + // @has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/subone/fn.bar.html"]' 'bar' |
| 15 | + /// See [bar] |
| 16 | + pub fn foo() {} |
| 17 | + // This should refer to subone's `foo` |
| 18 | + // @has issue_55364/subone/fn.bar.html |
| 19 | + // @has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/subone/fn.foo.html"]' 'foo' |
| 20 | + /// See [foo] |
| 21 | + pub fn bar() {} |
| 22 | +} |
| 23 | + |
| 24 | +// A module with outer documentation |
| 25 | + |
| 26 | +// @has issue_55364/subtwo/index.html |
| 27 | +// These foo/bar links in the module's documentation should not reference inside `subtwo` |
| 28 | +// @!has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/subtwo/fn.foo.html"]' 'foo' |
| 29 | +// @!has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/subtwo/fn.bar.html"]' 'bar' |
| 30 | +// Instead it should be referencing the top level functions |
| 31 | +// @has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/fn.foo.html"]' 'foo' |
| 32 | +// @has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/fn.bar.html"]' 'bar' |
| 33 | +// Though there should be such links later |
| 34 | +// @has - '//section[@id="main"]/table//tr[@class="module-item"]/td/a[@class="fn"][@href="fn.foo.html"]' 'foo' |
| 35 | +// @has - '//section[@id="main"]/table//tr[@class="module-item"]/td/a[@class="fn"][@href="fn.bar.html"]' 'bar' |
| 36 | +/// See either [foo] or [bar]. |
| 37 | +pub mod subtwo { |
| 38 | + |
| 39 | + // Despite the module's docs referring to the top level foo/bar, |
| 40 | + // this should refer to subtwo's `bar` |
| 41 | + // @has issue_55364/subtwo/fn.foo.html |
| 42 | + // @has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/subtwo/fn.bar.html"]' 'bar' |
| 43 | + /// See [bar] |
| 44 | + pub fn foo() {} |
| 45 | + // Despite the module's docs referring to the top level foo/bar, |
| 46 | + // this should refer to subtwo's `foo` |
| 47 | + // @has issue_55364/subtwo/fn.bar.html |
| 48 | + // @has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/subtwo/fn.foo.html"]' 'foo' |
| 49 | + /// See [foo] |
| 50 | + pub fn bar() {} |
| 51 | +} |
| 52 | + |
| 53 | +// These are the function referred to by the module above with outer docs |
| 54 | + |
| 55 | +/// See [bar] |
| 56 | +pub fn foo() {} |
| 57 | +/// See [foo] |
| 58 | +pub fn bar() {} |
| 59 | + |
| 60 | +// This module refers to the outer foo/bar by means of `super::` |
| 61 | + |
| 62 | +// @has issue_55364/subthree/index.html |
| 63 | +// This module should also refer to the top level foo/bar |
| 64 | +// @has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/fn.foo.html"]' 'foo' |
| 65 | +// @has - '//section[@id="main"]/div[@class="docblock"]//a[@href="../../issue_55364/fn.bar.html"]' 'bar' |
| 66 | +pub mod subthree { |
| 67 | + //! See either [foo][super::foo] or [bar][super::bar] |
| 68 | +} |
| 69 | + |
| 70 | +// Next we go *deeper* - In order to ensure it's not just "this or parent" |
| 71 | +// we test `crate::` and a `super::super::...` chain |
| 72 | +// @has issue_55364/subfour/subfive/subsix/subseven/subeight/index.html |
| 73 | +// @has - '//section[@id="main"]/table//tr[@class="module-item"]/td[@class="docblock-short"]//a[@href="../../../../../../issue_55364/subone/fn.foo.html"]' 'other foo' |
| 74 | +// @has - '//section[@id="main"]/table//tr[@class="module-item"]/td[@class="docblock-short"]//a[@href="../../../../../../issue_55364/subtwo/fn.bar.html"]' 'other bar' |
| 75 | +pub mod subfour { |
| 76 | + pub mod subfive { |
| 77 | + pub mod subsix { |
| 78 | + pub mod subseven { |
| 79 | + pub mod subeight { |
| 80 | + /// See [other foo][crate::subone::foo] |
| 81 | + pub fn foo() {} |
| 82 | + /// See [other bar][super::super::super::super::super::subtwo::bar] |
| 83 | + pub fn bar() {} |
| 84 | + } |
| 85 | + } |
| 86 | + } |
| 87 | + } |
| 88 | +} |
0 commit comments