about summary refs log tree commit diff
path: root/tests/rustdoc-js
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-11-14 20:45:15 +0100
committerGitHub <noreply@github.com>2024-11-14 20:45:15 +0100
commit8912909b98ef0ac835142cc7753cfdeefab3e259 (patch)
tree1c9884f7a6adc599b0d1a2b3f469d8e09035a057 /tests/rustdoc-js
parentdd61213be45c127a3031bce131a3b5a819079338 (diff)
parent32500aa8e0f23029c0fa69235d19f770106c016f (diff)
downloadrust-8912909b98ef0ac835142cc7753cfdeefab3e259.tar.gz
rust-8912909b98ef0ac835142cc7753cfdeefab3e259.zip
Rollup merge of #133043 - notriddle:master, r=fmease
rustdoc-search: case-sensitive only when capitals are used

This is the "smartcase" behavior, described by vim and dtolnay.

Fixes https://github.com/rust-lang/rust/issues/133017
Diffstat (limited to 'tests/rustdoc-js')
-rw-r--r--tests/rustdoc-js/case.js17
-rw-r--r--tests/rustdoc-js/case.rs7
2 files changed, 24 insertions, 0 deletions
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;