about summary refs log tree commit diff
path: root/tests/rustdoc/intra-doc/issue-108459.rs
diff options
context:
space:
mode:
authorbenediktwerner <1benediktwerner@gmail.com>2023-02-25 17:52:25 +0100
committerBenedikt Werner <1benediktwerner@gmail.com>2023-05-30 21:22:30 +0200
commit9968f3ce55d83baf916d55920b721d737581efc7 (patch)
treea0f51c9b122caccefaeac77d5b3bf4f822937266 /tests/rustdoc/intra-doc/issue-108459.rs
parent26c98689f2060ec834dbe8b8e80b24b31ffd48f2 (diff)
downloadrust-9968f3ce55d83baf916d55920b721d737581efc7.tar.gz
rust-9968f3ce55d83baf916d55920b721d737581efc7.zip
rustdoc: Fix LinkReplacer link matching
Diffstat (limited to 'tests/rustdoc/intra-doc/issue-108459.rs')
-rw-r--r--tests/rustdoc/intra-doc/issue-108459.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/rustdoc/intra-doc/issue-108459.rs b/tests/rustdoc/intra-doc/issue-108459.rs
new file mode 100644
index 00000000000..eb1c7a05e54
--- /dev/null
+++ b/tests/rustdoc/intra-doc/issue-108459.rs
@@ -0,0 +1,37 @@
+#![deny(rustdoc::broken_intra_doc_links)]
+
+pub struct S;
+pub mod char {}
+
+// Ensure this doesn't ICE due to trying to slice off non-existent backticks from "S"
+
+/// See [S] and [`S`]
+pub struct MyStruct1;
+
+// Ensure that link texts are replaced correctly even if there are multiple links with
+// the same target but different text
+
+/// See also [crate::char] and [mod@char] and [prim@char]
+// @has issue_108459/struct.MyStruct2.html '//*[@href="char/index.html"]' 'crate::char'
+// @has - '//*[@href="char/index.html"]' 'char'
+// @has - '//*[@href="{{channel}}/std/primitive.char.html"]' 'char'
+pub struct MyStruct2;
+
+/// See also [mod@char] and [prim@char] and [crate::char]
+// @has issue_108459/struct.MyStruct3.html '//*[@href="char/index.html"]' 'crate::char'
+// @has - '//*[@href="char/index.html"]' 'char'
+// @has - '//*[@href="{{channel}}/std/primitive.char.html"]' 'char'
+pub struct MyStruct3;
+
+// Ensure that links are correct even if there are multiple links with the same text but
+// different targets
+
+/// See also [char][mod@char] and [char][prim@char]
+// @has issue_108459/struct.MyStruct4.html '//*[@href="char/index.html"]' 'char'
+// @has - '//*[@href="{{channel}}/std/primitive.char.html"]' 'char'
+pub struct MyStruct4;
+
+/// See also [char][prim@char] and [char][crate::char]
+// @has issue_108459/struct.MyStruct5.html '//*[@href="char/index.html"]' 'char'
+// @has - '//*[@href="{{channel}}/std/primitive.char.html"]' 'char'
+pub struct MyStruct5;