about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/rustdoc-js-std/write.js24
-rw-r--r--tests/rustdoc-js/case.js17
-rw-r--r--tests/rustdoc-js/case.rs7
-rw-r--r--tests/rustdoc/footnote-reference-in-footnote-def.rs20
4 files changed, 68 insertions, 0 deletions
diff --git a/tests/rustdoc-js-std/write.js b/tests/rustdoc-js-std/write.js
new file mode 100644
index 00000000000..4a9475102a5
--- /dev/null
+++ b/tests/rustdoc-js-std/write.js
@@ -0,0 +1,24 @@
+const EXPECTED = [
+    {
+        'query': 'write',
+        'others': [
+            { 'path': 'std::fmt', 'name': 'write' },
+            { 'path': 'std::fs', 'name': 'write' },
+            { 'path': 'std::ptr', 'name': 'write' },
+            { 'path': 'std::fmt', 'name': 'Write' },
+            { 'path': 'std::io', 'name': 'Write' },
+            { 'path': 'std::hash::Hasher', 'name': 'write' },
+        ],
+    },
+    {
+        'query': 'Write',
+        'others': [
+            { 'path': 'std::fmt', 'name': 'Write' },
+            { 'path': 'std::io', 'name': 'Write' },
+            { 'path': 'std::fmt', 'name': 'write' },
+            { 'path': 'std::fs', 'name': 'write' },
+            { 'path': 'std::ptr', 'name': 'write' },
+            { 'path': 'std::hash::Hasher', 'name': 'write' },
+        ],
+    },
+];
diff --git a/tests/rustdoc-js/case.js b/tests/rustdoc-js/case.js
new file mode 100644
index 00000000000..22b970eb139
--- /dev/null
+++ b/tests/rustdoc-js/case.js
@@ -0,0 +1,17 @@
+const EXPECTED = [
+    {
+        'query': 'Foo',
+        'others': [
+            { 'path': 'case', 'name': 'Foo', 'desc': 'Docs for Foo' },
+            { 'path': 'case', 'name': 'foo', 'desc': 'Docs for foo' },
+        ],
+    },
+    {
+        'query': 'foo',
+        'others': [
+            // https://github.com/rust-lang/rust/issues/133017
+            { 'path': 'case', 'name': 'Foo', 'desc': 'Docs for Foo' },
+            { 'path': 'case', 'name': 'foo', 'desc': 'Docs for foo' },
+        ],
+    },
+];
diff --git a/tests/rustdoc-js/case.rs b/tests/rustdoc-js/case.rs
new file mode 100644
index 00000000000..532edd55f1d
--- /dev/null
+++ b/tests/rustdoc-js/case.rs
@@ -0,0 +1,7 @@
+#![allow(nonstandard_style)]
+
+/// Docs for Foo
+pub struct Foo;
+
+/// Docs for foo
+pub struct foo;
diff --git a/tests/rustdoc/footnote-reference-in-footnote-def.rs b/tests/rustdoc/footnote-reference-in-footnote-def.rs
new file mode 100644
index 00000000000..db3f9a59ef8
--- /dev/null
+++ b/tests/rustdoc/footnote-reference-in-footnote-def.rs
@@ -0,0 +1,20 @@
+// Checks that footnote references in footnote definitions are correctly generated.
+// Regression test for <https://github.com/rust-lang/rust/issues/131946>.
+
+#![crate_name = "foo"]
+
+//@ has 'foo/index.html'
+//@ has - '//*[@class="docblock"]/p/sup[@id="fnref1"]/a[@href="#fn1"]' '1'
+//@ has - '//li[@id="fn1"]/p' 'meow'
+//@ has - '//li[@id="fn1"]/p/sup[@id="fnref2"]/a[@href="#fn2"]' '2'
+//@ has - '//li[@id="fn1"]//a[@href="#fn2"]' '2'
+//@ has - '//li[@id="fn2"]/p' 'uwu'
+//@ has - '//li[@id="fn2"]/p/sup[@id="fnref1"]/a[@href="#fn1"]' '1'
+//@ has - '//li[@id="fn2"]//a[@href="#fn1"]' '1'
+
+//! # footnote-hell
+//!
+//! Hello [^a].
+//!
+//! [^a]: meow [^b]
+//! [^b]: uwu [^a]