diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-11-25 16:33:38 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-11-25 17:25:25 +0100 |
| commit | c8399255f3780072d1876ebed56decc7c78f378d (patch) | |
| tree | 31403296ea26cd2972ddb560b37ad1483b7167fa | |
| parent | d0a45cfeaa5e0861f0c363cc9d07aa94b429b820 (diff) | |
| download | rust-c8399255f3780072d1876ebed56decc7c78f378d.tar.gz rust-c8399255f3780072d1876ebed56decc7c78f378d.zip | |
Add regression test for prelude types
| -rw-r--r-- | tests/rustdoc/jump-to-def-prelude-types.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/rustdoc/jump-to-def-prelude-types.rs b/tests/rustdoc/jump-to-def-prelude-types.rs new file mode 100644 index 00000000000..43617b1bc9d --- /dev/null +++ b/tests/rustdoc/jump-to-def-prelude-types.rs @@ -0,0 +1,23 @@ +// This test checks that prelude types like `Result` and `Option` still get a link generated. + +//@ compile-flags: -Zunstable-options --generate-link-to-definition + +#![crate_name = "foo"] + +//@ has 'src/foo/jump-to-def-prelude-types.rs.html' +// FIXME: would be nice to be able to check both the class and the href at the same time so +// we could check the text as well... +//@ has - '//a[@class="prelude-ty"]/@href' '{{channel}}/core/result/enum.Result.html' +//@ has - '//a[@class="prelude-ty"]/@href' '{{channel}}/core/option/enum.Option.html' +pub fn foo() -> Result<Option<()>, ()> { Err(()) } + +// This part is to ensure that they are not linking to the actual prelude ty. +pub mod bar { + struct Result; + struct Option; + + //@ has - '//a[@href="#16"]' 'Result' + pub fn bar() -> Result { Result } + //@ has - '//a[@href="#17"]' 'Option' + pub fn bar2() -> Option { Option } +} |
