about summary refs log tree commit diff
path: root/tests/rustdoc-js/never-search.js
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2023-06-12 14:56:54 -0700
committerMichael Howell <michael@notriddle.com>2023-06-12 17:30:23 -0700
commitdb277f528407864e24d3d7934d9c23e28d950165 (patch)
tree27f6edb2a3b0e81f6e3265af83b2cd19ba4993fe /tests/rustdoc-js/never-search.js
parentdf77afbcaf3365a32066a8ca4a00ae6fc9a69647 (diff)
downloadrust-db277f528407864e24d3d7934d9c23e28d950165.tar.gz
rust-db277f528407864e24d3d7934d9c23e28d950165.zip
rustdoc-search: search never type with `!`
This feature extends rustdoc to support the syntax that most users will
naturally attempt to use to search for diverging functions.
Part of #60485

It's already possible to do this search with `primitive:never`, but
that's not what the Rust language itself uses, so nobody will try it if
they aren't told or helped along.
Diffstat (limited to 'tests/rustdoc-js/never-search.js')
-rw-r--r--tests/rustdoc-js/never-search.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/rustdoc-js/never-search.js b/tests/rustdoc-js/never-search.js
new file mode 100644
index 00000000000..ed24d693133
--- /dev/null
+++ b/tests/rustdoc-js/never-search.js
@@ -0,0 +1,46 @@
+// exact-check
+
+const EXPECTED = [
+    {
+        'query': '-> !',
+        'others': [
+            { 'path': 'never_search', 'name': 'loops' },
+        ],
+    },
+    {
+        'query': '-> never',
+        'others': [
+            { 'path': 'never_search', 'name': 'loops' },
+            { 'path': 'never_search', 'name': 'returns' },
+        ],
+    },
+    {
+        'query': '!',
+        'in_args': [
+            { 'path': 'never_search', 'name': 'impossible' },
+            { 'path': 'never_search', 'name': 'box_impossible' },
+        ],
+    },
+    {
+        'query': 'never',
+        'in_args': [
+            { 'path': 'never_search', 'name': 'impossible' },
+            { 'path': 'never_search', 'name': 'uninteresting' },
+            { 'path': 'never_search', 'name': 'box_impossible' },
+            { 'path': 'never_search', 'name': 'box_uninteresting' },
+        ],
+    },
+    {
+        'query': 'box<!>',
+        'in_args': [
+            { 'path': 'never_search', 'name': 'box_impossible' },
+        ],
+    },
+    {
+        'query': 'box<never>',
+        'in_args': [
+            { 'path': 'never_search', 'name': 'box_impossible' },
+            { 'path': 'never_search', 'name': 'box_uninteresting' },
+        ],
+    },
+];