about summary refs log tree commit diff
path: root/tests/rustdoc-js/reference.js
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2024-04-18 21:30:39 -0700
committerMichael Howell <michael@notriddle.com>2024-04-19 14:31:21 -0700
commit3c4e180e681e9c3e8c68de51585a1debd1f4bbdb (patch)
tree82d9185548111479588b704b8fe4984d8b37fd7d /tests/rustdoc-js/reference.js
parent8b47f6781792606fcf49724155bce4228e87be36 (diff)
downloadrust-3c4e180e681e9c3e8c68de51585a1debd1f4bbdb.tar.gz
rust-3c4e180e681e9c3e8c68de51585a1debd1f4bbdb.zip
rustdoc-search: add parser for `&` syntax
Diffstat (limited to 'tests/rustdoc-js/reference.js')
-rw-r--r--tests/rustdoc-js/reference.js101
1 files changed, 101 insertions, 0 deletions
diff --git a/tests/rustdoc-js/reference.js b/tests/rustdoc-js/reference.js
index dc40eee5687..b4a1fb15d36 100644
--- a/tests/rustdoc-js/reference.js
+++ b/tests/rustdoc-js/reference.js
@@ -132,4 +132,105 @@ const EXPECTED = [
         'query': 'reference<mut, reference<middle>>, reference<mut, reference<middle>> -> ()',
         'others': [],
     },
+    // pinkie with shorthand
+    {
+        'query': '&usize, usize -> ()',
+        'others': [
+            { 'path': 'reference', 'name': 'pinky' },
+        ],
+    },
+    {
+        'query': '&usize, &usize -> ()',
+        'others': [],
+    },
+    {
+        'query': '&mut usize, usize -> ()',
+        'others': [],
+    },
+    // thumb with shorthand
+    {
+        'query': '&thumb, thumb -> ()',
+        'others': [
+            { 'path': 'reference::Thumb', 'name': 'up' },
+        ],
+    },
+    {
+        'query': '&thumb, &thumb -> ()',
+        'others': [],
+    },
+    {
+        'query': '&mut thumb, thumb -> ()',
+        'others': [],
+    },
+    // index with explicit names
+    {
+        'query': '&index, index -> ()',
+        'others': [
+            { 'path': 'reference::Index', 'name': 'point' },
+        ],
+    },
+    {
+        'query': '&index, &index -> ()',
+        'others': [],
+    },
+    {
+        'query': '&mut index, index -> ()',
+        'others': [],
+    },
+    // ring with shorthand
+    {
+        'query': '&ring, ring -> ()',
+        'others': [
+            { 'path': 'reference::Ring', 'name': 'wear' },
+        ],
+    },
+    {
+        'query': '&ring, ring -> ()',
+        'others': [
+            { 'path': 'reference::Ring', 'name': 'wear' },
+        ],
+    },
+    {
+        'query': '&mut ring, &ring -> ()',
+        'others': [
+            { 'path': 'reference::Ring', 'name': 'wear' },
+        ],
+    },
+    {
+        'query': '&mut ring, &mut ring -> ()',
+        'others': [],
+    },
+    // middle with shorthand
+    {
+        'query': '&middle, &middle -> ()',
+        'others': [
+            { 'path': 'reference', 'name': 'show' },
+        ],
+    },
+    {
+        'query': '&mut middle, &mut middle -> ()',
+        'others': [
+            { 'path': 'reference', 'name': 'show' },
+        ],
+    },
+    {
+        'query': '&&mut middle, &mut &middle -> ()',
+        'others': [
+            { 'path': 'reference', 'name': 'show' },
+        ],
+    },
+    {
+        'query': '&mut &middle, &&mut middle -> ()',
+        'others': [
+            { 'path': 'reference', 'name': 'show' },
+        ],
+    },
+    {
+        'query': '&&mut middle, &&mut middle -> ()',
+        'others': [],
+    },
+    {
+        'query': '&mut &middle, &mut &middle -> ()',
+        'others': [],
+    },
 ];