about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-09-12 20:02:17 +1000
committerGitHub <noreply@github.com>2025-09-12 20:02:17 +1000
commit249730f521921016e19d226a7799d5bdc879f8f2 (patch)
treeed996610b0392bf5aedefa23a775a44011b9e688 /tests
parent2e51a389996f63f06b2346874de55ede682d7a76 (diff)
parent04a1dd1c175cb0fc18419e0261f99bf35199ab59 (diff)
downloadrust-249730f521921016e19d226a7799d5bdc879f8f2.tar.gz
rust-249730f521921016e19d226a7799d5bdc879f8f2.zip
Rollup merge of #146448 - GuillaumeGomez:fix-literal-search-paths, r=lolbinarycat
[rustdoc] Correctly handle literal search on paths

Fixes https://github.com/rust-lang/rust/issues/146129.

cc ```@notriddle```
r? ```@lolbinarycat```
Diffstat (limited to 'tests')
-rw-r--r--tests/rustdoc-js/literal-path.js23
-rw-r--r--tests/rustdoc-js/literal-path.rs7
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/rustdoc-js/literal-path.js b/tests/rustdoc-js/literal-path.js
new file mode 100644
index 00000000000..ea999ea1a6f
--- /dev/null
+++ b/tests/rustdoc-js/literal-path.js
@@ -0,0 +1,23 @@
+// exact-check
+
+// This test ensures that literal search is always applied on elements of the path.
+
+const EXPECTED = [
+    {
+        'query': '"some::path"',
+        'others': [
+            { 'path': 'literal_path::some', 'name': 'Path' },
+        ],
+    },
+    {
+        'query': '"somea::path"',
+        'others': [
+            { 'path': 'literal_path::somea', 'name': 'Path' },
+        ],
+    },
+    {
+        'query': '"soma::path"',
+        'others': [
+        ],
+    },
+];
diff --git a/tests/rustdoc-js/literal-path.rs b/tests/rustdoc-js/literal-path.rs
new file mode 100644
index 00000000000..fa7685fd966
--- /dev/null
+++ b/tests/rustdoc-js/literal-path.rs
@@ -0,0 +1,7 @@
+pub mod some {
+    pub struct Path;
+}
+
+pub mod somea {
+    pub struct Path;
+}