diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2021-04-13 22:03:29 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2021-08-05 23:08:28 +0200 |
| commit | 71763a52ff221fe8f32b217e92d49b903f6826bb (patch) | |
| tree | 0a4d617a25d420e0e86526dbbc4bddced51b9c09 /src/test/rustdoc/check-source-code-urls-to-def.rs | |
| parent | b689cedc0e44a6a1f75b0589ecb2eb4e890e71e4 (diff) | |
| download | rust-71763a52ff221fe8f32b217e92d49b903f6826bb.tar.gz rust-71763a52ff221fe8f32b217e92d49b903f6826bb.zip | |
Add test for source code pages URLs
Diffstat (limited to 'src/test/rustdoc/check-source-code-urls-to-def.rs')
| -rw-r--r-- | src/test/rustdoc/check-source-code-urls-to-def.rs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/test/rustdoc/check-source-code-urls-to-def.rs b/src/test/rustdoc/check-source-code-urls-to-def.rs new file mode 100644 index 00000000000..32973ba3faf --- /dev/null +++ b/src/test/rustdoc/check-source-code-urls-to-def.rs @@ -0,0 +1,38 @@ +// compile-flags: -Zunstable-options --generate-link-to-definition + +#![crate_name = "foo"] + +#[path = "auxiliary/source-code-bar.rs"] +pub mod bar; + +// @has 'src/foo/check-source-code-urls-to-def.rs.html' + +// @count - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#5-7"]' 4 +use bar::Bar; +// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#13-17"]' 'self' +// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#14-16"]' 'Trait' +use bar::sub::{self, Trait}; + +pub struct Foo; + +impl Foo { + fn hello(&self) {} +} + +fn babar() {} + +// @has - '//a[@href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html"]' 'String' +// @count - '//a[@href="../../src/foo/check-source-code-urls-to-def.rs.html#16"]' 5 +pub fn foo(a: u32, b: &str, c: String, d: Foo, e: bar::Bar) { + let x = 12; + let y: Foo = Foo; + let z: Bar = bar::Bar { field: Foo }; + babar(); + // @has - '//a[@href="../../src/foo/check-source-code-urls-to-def.rs.html#19"]' 'hello' + y.hello(); +} + +// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#14-16"]' 'bar::sub::Trait' +// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#14-16"]' 'Trait' +pub fn foo2<T: bar::sub::Trait, V: Trait>(t: &T, v: &V) { +} |
