Skip to content

Commit c839925

Browse files
Add regression test for prelude types
1 parent d0a45cf commit c839925

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// This test checks that prelude types like `Result` and `Option` still get a link generated.
2+
3+
//@ compile-flags: -Zunstable-options --generate-link-to-definition
4+
5+
#![crate_name = "foo"]
6+
7+
//@ has 'src/foo/jump-to-def-prelude-types.rs.html'
8+
// FIXME: would be nice to be able to check both the class and the href at the same time so
9+
// we could check the text as well...
10+
//@ has - '//a[@class="prelude-ty"]/@href' '{{channel}}/core/result/enum.Result.html'
11+
//@ has - '//a[@class="prelude-ty"]/@href' '{{channel}}/core/option/enum.Option.html'
12+
pub fn foo() -> Result<Option<()>, ()> { Err(()) }
13+
14+
// This part is to ensure that they are not linking to the actual prelude ty.
15+
pub mod bar {
16+
struct Result;
17+
struct Option;
18+
19+
//@ has - '//a[@href="#16"]' 'Result'
20+
pub fn bar() -> Result { Result }
21+
//@ has - '//a[@href="#17"]' 'Option'
22+
pub fn bar2() -> Option { Option }
23+
}

0 commit comments

Comments
 (0)