Skip to content

Commit d73c0a3

Browse files
committedSep 13, 2021
Add test for primitive in "jump to definition" feature
1 parent 8f3fd3d commit d73c0a3

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// compile-flags: -Zunstable-options --generate-link-to-definition
2+
3+
#![crate_name = "foo"]
4+
5+
// @has 'src/foo/check-source-code-urls-to-def-std.rs.html'
6+
7+
fn babar() {}
8+
9+
// @has - '//a[@href="{{channel}}/std/primitive.u32.html"]' 'u32'
10+
// @has - '//a[@href="{{channel}}/std/primitive.str.html"]' 'str'
11+
// @has - '//a[@href="{{channel}}/std/primitive.bool.html"]' 'bool'
12+
// @has - '//a[@href="../../src/foo/check-source-code-urls-to-def-std.rs.html#7"]' 'babar'
13+
pub fn foo(a: u32, b: &str, c: String) {
14+
let x = 12;
15+
let y: bool = true;
16+
babar();
17+
}

‎src/test/rustdoc/check-source-code-urls-to-def.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ impl Foo {
2727
fn babar() {}
2828

2929
// @has - '//a/@href' '/struct.String.html'
30+
// @has - '//a/@href' '/primitive.u32.html'
31+
// @has - '//a/@href' '/primitive.str.html'
3032
// @count - '//a[@href="../../src/foo/check-source-code-urls-to-def.rs.html#21"]' 5
3133
// @has - '//a[@href="../../source_code/struct.SourceCode.html"]' 'source_code::SourceCode'
3234
pub fn foo(a: u32, b: &str, c: String, d: Foo, e: bar::Bar, f: source_code::SourceCode) {
@@ -40,5 +42,9 @@ pub fn foo(a: u32, b: &str, c: String, d: Foo, e: bar::Bar, f: source_code::Sour
4042

4143
// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#14-16"]' 'bar::sub::Trait'
4244
// @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#14-16"]' 'Trait'
43-
pub fn foo2<T: bar::sub::Trait, V: Trait>(t: &T, v: &V) {
45+
pub fn foo2<T: bar::sub::Trait, V: Trait>(t: &T, v: &V, b: bool) {
4446
}
47+
48+
// @has - '//a[@href="../../foo/primitive.bool.html"]' 'bool'
49+
#[doc(primitive = "bool")]
50+
mod whatever {}

0 commit comments

Comments
 (0)
Please sign in to comment.