Skip to content

Commit 71763a5

Browse files
Add test for source code pages URLs
1 parent b689ced commit 71763a5

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//! just some other file. :)
2+
3+
use crate::Foo;
4+
5+
pub struct Bar {
6+
field: Foo,
7+
}
8+
9+
pub struct Bar2 {
10+
field: crate::Foo,
11+
}
12+
13+
pub mod sub {
14+
pub trait Trait {
15+
fn tadam() {}
16+
}
17+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// compile-flags: -Zunstable-options --generate-link-to-definition
2+
3+
#![crate_name = "foo"]
4+
5+
#[path = "auxiliary/source-code-bar.rs"]
6+
pub mod bar;
7+
8+
// @has 'src/foo/check-source-code-urls-to-def.rs.html'
9+
10+
// @count - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#5-7"]' 4
11+
use bar::Bar;
12+
// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#13-17"]' 'self'
13+
// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#14-16"]' 'Trait'
14+
use bar::sub::{self, Trait};
15+
16+
pub struct Foo;
17+
18+
impl Foo {
19+
fn hello(&self) {}
20+
}
21+
22+
fn babar() {}
23+
24+
// @has - '//a[@href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html"]' 'String'
25+
// @count - '//a[@href="../../src/foo/check-source-code-urls-to-def.rs.html#16"]' 5
26+
pub fn foo(a: u32, b: &str, c: String, d: Foo, e: bar::Bar) {
27+
let x = 12;
28+
let y: Foo = Foo;
29+
let z: Bar = bar::Bar { field: Foo };
30+
babar();
31+
// @has - '//a[@href="../../src/foo/check-source-code-urls-to-def.rs.html#19"]' 'hello'
32+
y.hello();
33+
}
34+
35+
// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#14-16"]' 'bar::sub::Trait'
36+
// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#14-16"]' 'Trait'
37+
pub fn foo2<T: bar::sub::Trait, V: Trait>(t: &T, v: &V) {
38+
}

0 commit comments

Comments
 (0)