about summary refs log tree commit diff
path: root/tests/rustdoc-js
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-09-11 18:05:21 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2025-09-11 18:05:21 +0200
commit04a1dd1c175cb0fc18419e0261f99bf35199ab59 (patch)
treedb85b4c3fc1ce082447c8454ac57343bed1c44df /tests/rustdoc-js
parentbfd5a264c7e02ee831aab919c272539cf9395a1d (diff)
downloadrust-04a1dd1c175cb0fc18419e0261f99bf35199ab59.tar.gz
rust-04a1dd1c175cb0fc18419e0261f99bf35199ab59.zip
Add regression test for literal search on paths
Diffstat (limited to 'tests/rustdoc-js')
-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;
+}