about summary refs log tree commit diff
path: root/tests/rustdoc-js-std
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rustdoc-js-std')
-rw-r--r--tests/rustdoc-js-std/alias-1.js10
-rw-r--r--tests/rustdoc-js-std/alias-2.js9
-rw-r--r--tests/rustdoc-js-std/alias-3.js6
-rw-r--r--tests/rustdoc-js-std/alias-4.js6
-rw-r--r--tests/rustdoc-js-std/alias.js10
-rw-r--r--tests/rustdoc-js-std/asrawfd.js12
-rw-r--r--tests/rustdoc-js-std/basic.js14
-rw-r--r--tests/rustdoc-js-std/bufread-fill-buf.js16
-rw-r--r--tests/rustdoc-js-std/const-is-nullary-func.js7
-rw-r--r--tests/rustdoc-js-std/core-transmute.js11
-rw-r--r--tests/rustdoc-js-std/deduplication.js9
-rw-r--r--tests/rustdoc-js-std/enum-option.js6
-rw-r--r--tests/rustdoc-js-std/exact-case.js7
-rw-r--r--tests/rustdoc-js-std/field-is-unary-func.js7
-rw-r--r--tests/rustdoc-js-std/filter-crate.js9
-rw-r--r--tests/rustdoc-js-std/fn-forget.js7
-rw-r--r--tests/rustdoc-js-std/from_u.js8
-rw-r--r--tests/rustdoc-js-std/full-path-function.js7
-rw-r--r--tests/rustdoc-js-std/iterator-type-signatures.js29
-rw-r--r--tests/rustdoc-js-std/keyword.js9
-rw-r--r--tests/rustdoc-js-std/macro-check.js9
-rw-r--r--tests/rustdoc-js-std/macro-print.js9
-rw-r--r--tests/rustdoc-js-std/never.js14
-rw-r--r--tests/rustdoc-js-std/option-type-signatures.js203
-rw-r--r--tests/rustdoc-js-std/osstring-to-string.js9
-rw-r--r--tests/rustdoc-js-std/parser-bindings.js237
-rw-r--r--tests/rustdoc-js-std/parser-errors.js495
-rw-r--r--tests/rustdoc-js-std/parser-filter.js156
-rw-r--r--tests/rustdoc-js-std/parser-generics.js173
-rw-r--r--tests/rustdoc-js-std/parser-hof.js694
-rw-r--r--tests/rustdoc-js-std/parser-ident.js143
-rw-r--r--tests/rustdoc-js-std/parser-literal.js25
-rw-r--r--tests/rustdoc-js-std/parser-paths.js135
-rw-r--r--tests/rustdoc-js-std/parser-quote.js72
-rw-r--r--tests/rustdoc-js-std/parser-reference.js510
-rw-r--r--tests/rustdoc-js-std/parser-returned.js156
-rw-r--r--tests/rustdoc-js-std/parser-separators.js187
-rw-r--r--tests/rustdoc-js-std/parser-slice-array.js305
-rw-r--r--tests/rustdoc-js-std/parser-tuple.js344
-rw-r--r--tests/rustdoc-js-std/parser-weird-queries.js85
-rw-r--r--tests/rustdoc-js-std/path-end-empty.js6
-rw-r--r--tests/rustdoc-js-std/path-maxeditdistance.js34
-rw-r--r--tests/rustdoc-js-std/path-ordering.js19
-rw-r--r--tests/rustdoc-js-std/primitive.js72
-rw-r--r--tests/rustdoc-js-std/println-typo.js12
-rw-r--r--tests/rustdoc-js-std/quoted.js21
-rw-r--r--tests/rustdoc-js-std/reference-shrink.js7
-rw-r--r--tests/rustdoc-js-std/regex.js9
-rw-r--r--tests/rustdoc-js-std/return-based-sort.js30
-rw-r--r--tests/rustdoc-js-std/return-specific-literal.js9
-rw-r--r--tests/rustdoc-js-std/return-specific.js9
-rw-r--r--tests/rustdoc-js-std/should-fail.js8
-rw-r--r--tests/rustdoc-js-std/simd-type-signatures.js70
-rw-r--r--tests/rustdoc-js-std/string-from_ut.js10
-rw-r--r--tests/rustdoc-js-std/struct-vec.js7
-rw-r--r--tests/rustdoc-js-std/transmute-fail.js14
-rw-r--r--tests/rustdoc-js-std/transmute.js13
-rw-r--r--tests/rustdoc-js-std/typed-query.js13
-rw-r--r--tests/rustdoc-js-std/unbox-type-result.js20
-rw-r--r--tests/rustdoc-js-std/vec-new.js50
-rw-r--r--tests/rustdoc-js-std/vec-type-signatures.js34
-rw-r--r--tests/rustdoc-js-std/write.js24
62 files changed, 4651 insertions, 0 deletions
diff --git a/tests/rustdoc-js-std/alias-1.js b/tests/rustdoc-js-std/alias-1.js
new file mode 100644
index 00000000000..c31d1a3b1ad
--- /dev/null
+++ b/tests/rustdoc-js-std/alias-1.js
@@ -0,0 +1,10 @@
+const EXPECTED = {
+    'query': '&',
+    'others': [
+        {
+            'path': 'std',
+            'name': 'reference',
+            'desc': "References, <code>&amp;T</code> and <code>&amp;mut T</code>.",
+        },
+    ],
+};
diff --git a/tests/rustdoc-js-std/alias-2.js b/tests/rustdoc-js-std/alias-2.js
new file mode 100644
index 00000000000..5735b573bcb
--- /dev/null
+++ b/tests/rustdoc-js-std/alias-2.js
@@ -0,0 +1,9 @@
+const EXPECTED = {
+    'query': '+',
+    'others': [
+        { 'path': 'std::ops', 'name': 'AddAssign' },
+        { 'path': 'std::ops', 'name': 'Add' },
+        { 'path': 'core::ops', 'name': 'AddAssign' },
+        { 'path': 'core::ops', 'name': 'Add' },
+    ],
+};
diff --git a/tests/rustdoc-js-std/alias-3.js b/tests/rustdoc-js-std/alias-3.js
new file mode 100644
index 00000000000..ed3776b3c2a
--- /dev/null
+++ b/tests/rustdoc-js-std/alias-3.js
@@ -0,0 +1,6 @@
+const EXPECTED = {
+    'query': '!',
+    'others': [
+        { 'path': 'std', 'name': 'never' },
+    ],
+};
diff --git a/tests/rustdoc-js-std/alias-4.js b/tests/rustdoc-js-std/alias-4.js
new file mode 100644
index 00000000000..35840a472c1
--- /dev/null
+++ b/tests/rustdoc-js-std/alias-4.js
@@ -0,0 +1,6 @@
+const EXPECTED = {
+    'query': '<',
+    'others': [
+        { 'name': 'Ord' },
+    ],
+};
diff --git a/tests/rustdoc-js-std/alias.js b/tests/rustdoc-js-std/alias.js
new file mode 100644
index 00000000000..bf707fa03dc
--- /dev/null
+++ b/tests/rustdoc-js-std/alias.js
@@ -0,0 +1,10 @@
+// ignore-order
+
+const EXPECTED = {
+    'query': '[',
+    'others': [
+        { 'path': 'std', 'name': 'slice' },
+        { 'path': 'std::ops', 'name': 'IndexMut' },
+        { 'path': 'std::ops', 'name': 'Index' },
+    ],
+};
diff --git a/tests/rustdoc-js-std/asrawfd.js b/tests/rustdoc-js-std/asrawfd.js
new file mode 100644
index 00000000000..5dbc4ba95d9
--- /dev/null
+++ b/tests/rustdoc-js-std/asrawfd.js
@@ -0,0 +1,12 @@
+// ignore-order
+
+const EXPECTED = {
+    'query': 'RawFd::as_raw_fd',
+    'others': [
+        // Reproduction test for https://github.com/rust-lang/rust/issues/78724
+        // Validate that type alias methods get the correct path.
+        { 'path': 'std::os::fd::AsRawFd', 'name': 'as_raw_fd' },
+        { 'path': 'std::os::fd::AsRawFd', 'name': 'as_raw_fd' },
+        { 'path': 'std::os::fd::RawFd', 'name': 'as_raw_fd' },
+    ],
+};
diff --git a/tests/rustdoc-js-std/basic.js b/tests/rustdoc-js-std/basic.js
new file mode 100644
index 00000000000..baff24b0af6
--- /dev/null
+++ b/tests/rustdoc-js-std/basic.js
@@ -0,0 +1,14 @@
+const EXPECTED = {
+    'query': 'String',
+    'others': [
+        { 'path': 'std::string', 'name': 'String' },
+        { 'path': 'std::ffi', 'name': 'CString' },
+        { 'path': 'std::ffi', 'name': 'OsString' },
+    ],
+    'in_args': [
+        { 'path': 'std::str', 'name': 'eq' },
+    ],
+    'returned': [
+        { 'path': 'std::string::String', 'name': 'add' },
+    ],
+};
diff --git a/tests/rustdoc-js-std/bufread-fill-buf.js b/tests/rustdoc-js-std/bufread-fill-buf.js
new file mode 100644
index 00000000000..6b9309f6864
--- /dev/null
+++ b/tests/rustdoc-js-std/bufread-fill-buf.js
@@ -0,0 +1,16 @@
+// ignore-order
+
+const EXPECTED = [
+    {
+        'query': 'bufread -> result<[u8]>',
+        'others': [
+            { 'path': 'std::boxed::Box', 'name': 'fill_buf' },
+        ],
+    },
+    {
+        'query': 'split<bufread> -> option<result<vec<u8>>>',
+        'others': [
+            { 'path': 'std::io::Split', 'name': 'next' },
+        ],
+    },
+];
diff --git a/tests/rustdoc-js-std/const-is-nullary-func.js b/tests/rustdoc-js-std/const-is-nullary-func.js
new file mode 100644
index 00000000000..e929741b038
--- /dev/null
+++ b/tests/rustdoc-js-std/const-is-nullary-func.js
@@ -0,0 +1,7 @@
+const EXPECTED = {
+    'query': '-> char',
+    'others': [
+        { 'path': 'std::char', 'name': 'from_digit' },
+        { 'path': 'std::char', 'name': 'MAX' },
+    ],
+}
diff --git a/tests/rustdoc-js-std/core-transmute.js b/tests/rustdoc-js-std/core-transmute.js
new file mode 100644
index 00000000000..8c9910a32d7
--- /dev/null
+++ b/tests/rustdoc-js-std/core-transmute.js
@@ -0,0 +1,11 @@
+const FILTER_CRATE = "core";
+const EXPECTED = [
+    {
+        'query': 'generic:T -> generic:U',
+        'others': [
+            { 'path': 'core::intrinsics::simd', 'name': 'simd_as' },
+            { 'path': 'core::intrinsics::simd', 'name': 'simd_cast' },
+            { 'path': 'core::mem', 'name': 'transmute' },
+        ],
+    },
+];
diff --git a/tests/rustdoc-js-std/deduplication.js b/tests/rustdoc-js-std/deduplication.js
new file mode 100644
index 00000000000..95049d0a174
--- /dev/null
+++ b/tests/rustdoc-js-std/deduplication.js
@@ -0,0 +1,9 @@
+// ignore-order
+
+const EXPECTED = {
+    'query': 'is_nan',
+    'others': [
+        { 'path': 'std::f32', 'name': 'is_nan' },
+        { 'path': 'std::f64', 'name': 'is_nan' },
+    ],
+};
diff --git a/tests/rustdoc-js-std/enum-option.js b/tests/rustdoc-js-std/enum-option.js
new file mode 100644
index 00000000000..216dafe3b12
--- /dev/null
+++ b/tests/rustdoc-js-std/enum-option.js
@@ -0,0 +1,6 @@
+const EXPECTED = {
+    'query': 'enum:Option',
+    'others': [
+        { 'path': 'std::option', 'name': 'Option' },
+    ],
+};
diff --git a/tests/rustdoc-js-std/exact-case.js b/tests/rustdoc-js-std/exact-case.js
new file mode 100644
index 00000000000..d9faff22fff
--- /dev/null
+++ b/tests/rustdoc-js-std/exact-case.js
@@ -0,0 +1,7 @@
+const EXPECTED = {
+    'query': 'Copy',
+    'others': [
+        { 'path': 'std::marker', 'name': 'Copy' },
+        { 'path': 'std::fs', 'name': 'copy' },
+    ],
+}
diff --git a/tests/rustdoc-js-std/field-is-unary-func.js b/tests/rustdoc-js-std/field-is-unary-func.js
new file mode 100644
index 00000000000..09ce8a0dde0
--- /dev/null
+++ b/tests/rustdoc-js-std/field-is-unary-func.js
@@ -0,0 +1,7 @@
+const EXPECTED = {
+    // one of the only non-generic structs with public fields
+    'query': 'CpuidResult -> u32',
+    'others': [
+        { 'path': 'core::arch::x86::CpuidResult', 'name': 'eax' },
+    ],
+}
diff --git a/tests/rustdoc-js-std/filter-crate.js b/tests/rustdoc-js-std/filter-crate.js
new file mode 100644
index 00000000000..95f2969d299
--- /dev/null
+++ b/tests/rustdoc-js-std/filter-crate.js
@@ -0,0 +1,9 @@
+// exact-check
+
+const FILTER_CRATE = 'core';
+
+const EXPECTED = {
+    'query': 'hashmap',
+    'others': [
+    ],
+};
diff --git a/tests/rustdoc-js-std/fn-forget.js b/tests/rustdoc-js-std/fn-forget.js
new file mode 100644
index 00000000000..addecf4e44f
--- /dev/null
+++ b/tests/rustdoc-js-std/fn-forget.js
@@ -0,0 +1,7 @@
+const EXPECTED = {
+    'query': 'fn:forget',
+    'others': [
+        { 'path': 'std::mem', 'name': 'forget' },
+        { 'path': 'std::fmt', 'name': 'format' },
+    ],
+};
diff --git a/tests/rustdoc-js-std/from_u.js b/tests/rustdoc-js-std/from_u.js
new file mode 100644
index 00000000000..7c9375ba529
--- /dev/null
+++ b/tests/rustdoc-js-std/from_u.js
@@ -0,0 +1,8 @@
+const EXPECTED = {
+    'query': 'from_u',
+    'others': [
+        { 'path': 'std::char', 'name': 'from_u32' },
+        { 'path': 'std::str', 'name': 'from_utf8' },
+        { 'path': 'std::string::String', 'name': 'from_utf8' },
+    ],
+};
diff --git a/tests/rustdoc-js-std/full-path-function.js b/tests/rustdoc-js-std/full-path-function.js
new file mode 100644
index 00000000000..ac157b3aadf
--- /dev/null
+++ b/tests/rustdoc-js-std/full-path-function.js
@@ -0,0 +1,7 @@
+const EXPECTED = {
+    'query': 'vec::vec -> usize',
+    'others': [
+        { 'path': 'std::vec::Vec', 'name': 'len' },
+        { 'path': 'std::vec::Vec', 'name': 'capacity' },
+    ],
+};
diff --git a/tests/rustdoc-js-std/iterator-type-signatures.js b/tests/rustdoc-js-std/iterator-type-signatures.js
new file mode 100644
index 00000000000..c18ffc1651c
--- /dev/null
+++ b/tests/rustdoc-js-std/iterator-type-signatures.js
@@ -0,0 +1,29 @@
+// ignore-order
+
+const FILTER_CRATE = "std";
+
+const EXPECTED = [
+    {
+        'query': 'iterator<t> -> option<t>',
+        'others': [
+            { 'path': 'std::iter::Iterator', 'name': 'max' },
+            { 'path': 'std::iter::Iterator', 'name': 'min' },
+            { 'path': 'std::iter::Iterator', 'name': 'last' },
+            { 'path': 'std::iter::Iterator', 'name': 'next' },
+        ],
+    },
+    {
+        'query': 'iterator<t>, usize -> option<t>',
+        'others': [
+            { 'path': 'std::iter::Iterator', 'name': 'nth' },
+        ],
+    },
+    {
+        // Something should be done so that intoiterator is considered a match
+        // for plain iterator.
+        'query': 'iterator<t>, intoiterator<t> -> ordering',
+        'others': [
+            { 'path': 'std::iter::Iterator', 'name': 'cmp' },
+        ],
+    },
+];
diff --git a/tests/rustdoc-js-std/keyword.js b/tests/rustdoc-js-std/keyword.js
new file mode 100644
index 00000000000..1837b1e71f7
--- /dev/null
+++ b/tests/rustdoc-js-std/keyword.js
@@ -0,0 +1,9 @@
+// ignore-order
+
+const EXPECTED = {
+    'query': 'fn',
+    'others': [
+        { 'path': 'std', 'name': 'fn', ty: 1 }, // 1 is for primitive types
+        { 'path': 'std', 'name': 'fn', ty: 0 }, // 0 is for keywords
+    ],
+};
diff --git a/tests/rustdoc-js-std/macro-check.js b/tests/rustdoc-js-std/macro-check.js
new file mode 100644
index 00000000000..37d5e7dae62
--- /dev/null
+++ b/tests/rustdoc-js-std/macro-check.js
@@ -0,0 +1,9 @@
+// ignore-order
+
+const EXPECTED = {
+    'query': 'panic',
+    'others': [
+        { 'path': 'std', 'name': 'panic', ty: 16 }, // 16 is for macros
+        { 'path': 'std', 'name': 'panic', ty: 2 }, // 2 is for modules
+    ],
+};
diff --git a/tests/rustdoc-js-std/macro-print.js b/tests/rustdoc-js-std/macro-print.js
new file mode 100644
index 00000000000..2ef1c89e49b
--- /dev/null
+++ b/tests/rustdoc-js-std/macro-print.js
@@ -0,0 +1,9 @@
+const EXPECTED = {
+    'query': 'macro:print',
+    'others': [
+        { 'path': 'std', 'name': 'print' },
+        { 'path': 'std', 'name': 'println' },
+        { 'path': 'std', 'name': 'eprint' },
+        { 'path': 'std', 'name': 'eprintln' },
+    ],
+};
diff --git a/tests/rustdoc-js-std/never.js b/tests/rustdoc-js-std/never.js
new file mode 100644
index 00000000000..27d415b5e48
--- /dev/null
+++ b/tests/rustdoc-js-std/never.js
@@ -0,0 +1,14 @@
+const EXPECTED = [
+    {
+        'query': '!',
+        'others': [
+            { 'path': 'std', 'name': 'never' },
+        ],
+    },
+    {
+        'query': '!::clone',
+        'others': [
+            { 'path': 'std::never', 'name': 'clone' },
+        ],
+    },
+];
diff --git a/tests/rustdoc-js-std/option-type-signatures.js b/tests/rustdoc-js-std/option-type-signatures.js
new file mode 100644
index 00000000000..3be18e6adf3
--- /dev/null
+++ b/tests/rustdoc-js-std/option-type-signatures.js
@@ -0,0 +1,203 @@
+// ignore-order
+
+const FILTER_CRATE = "std";
+
+const EXPECTED = [
+    {
+        'query': 'option, fnonce -> option',
+        'others': [
+            {
+                'path': 'std::option::Option',
+                'name': 'map',
+                'displayType': '`Option`<T>, F -> `Option`<U>',
+                'displayWhereClause': "F: `FnOnce` (T) -> U",
+            },
+        ],
+    },
+    {
+        'query': 'option<t>, fnonce -> option',
+        'others': [
+            {
+                'path': 'std::option::Option',
+                'name': 'map',
+                'displayType': '`Option`<`T`>, F -> `Option`<U>',
+                'displayWhereClause': "F: `FnOnce` (T) -> U",
+            },
+        ],
+    },
+    {
+        'query': 'option -> default',
+        'others': [
+            {
+                'path': 'std::option::Option',
+                'name': 'unwrap_or_default',
+                'displayType': '`Option`<T> -> `T`',
+                'displayWhereClause': "T: `Default`",
+            },
+            {
+                'path': 'std::option::Option',
+                'name': 'get_or_insert_default',
+                'displayType': '&mut `Option`<T> -> &mut `T`',
+                'displayWhereClause': "T: `Default`",
+            },
+        ],
+    },
+    {
+        'query': 'option -> []',
+        'others': [
+            {
+                'path': 'std::option::Option',
+                'name': 'as_slice',
+                'displayType': '&`Option`<T> -> &`[`T`]`',
+            },
+            {
+                'path': 'std::option::Option',
+                'name': 'as_mut_slice',
+                'displayType': '&mut `Option`<T> -> &mut `[`T`]`',
+            },
+        ],
+    },
+    {
+        'query': 'option<t>, option<t> -> option<t>',
+        'others': [
+            {
+                'path': 'std::option::Option',
+                'name': 'or',
+                'displayType': '`Option`<`T`>, `Option`<`T`> -> `Option`<`T`>',
+            },
+            {
+                'path': 'std::option::Option',
+                'name': 'xor',
+                'displayType': '`Option`<`T`>, `Option`<`T`> -> `Option`<`T`>',
+            },
+        ],
+    },
+    {
+        'query': 'option<t>, option<u> -> option<u>',
+        'others': [
+            {
+                'path': 'std::option::Option',
+                'name': 'and',
+                'displayType': '`Option`<`T`>, `Option`<`U`> -> `Option`<`U`>',
+            },
+        ],
+    },
+    {
+        'query': 'option<t>, option<u> -> option<t>',
+        'others': [
+            {
+                'path': 'std::option::Option',
+                'name': 'and',
+                'displayType': '`Option`<`T`>, `Option`<`U`> -> `Option`<`U`>',
+            },
+            {
+                'path': 'std::option::Option',
+                'name': 'zip',
+                'displayType': '`Option`<`T`>, `Option`<`U`> -> `Option`<(`T`, U)>',
+            },
+        ],
+    },
+    {
+        'query': 'option<t>, option<u> -> option<(t, u)>',
+        'others': [
+            {
+                'path': 'std::option::Option',
+                'name': 'zip',
+                'displayType': '`Option`<`T`>, `Option`<`U`> -> `Option`<`(T`, `U)`>',
+            },
+        ],
+    },
+    {
+        'query': 'option<t>, e -> result<t, e>',
+        'others': [
+            {
+                'path': 'std::option::Option',
+                'name': 'ok_or',
+                'displayType': '`Option`<`T`>, `E` -> `Result`<`T`, `E`>',
+            },
+            {
+                'path': 'std::result::Result',
+                'name': 'transpose',
+                'displayType': 'Result<`Option`<`T`>, `E`> -> Option<`Result`<`T`, `E`>>',
+            },
+        ],
+    },
+    {
+        'query': 'result<option<t>, e> -> option<result<t, e>>',
+        'others': [
+            {
+                'path': 'std::result::Result',
+                'name': 'transpose',
+                'displayType': '`Result`<`Option`<`T`>, `E`> -> `Option`<`Result`<`T`, `E`>>',
+            },
+        ],
+    },
+    {
+        'query': 'option<t>, option<t> -> bool',
+        'others': [
+            {
+                'path': 'std::option::Option',
+                'name': 'eq',
+                'displayType': '&`Option`<`T`>, &`Option`<`T`> -> `bool`',
+            },
+        ],
+    },
+    {
+        'query': 'option<option<t>> -> option<t>',
+        'others': [
+            {
+                'path': 'std::option::Option',
+                'name': 'flatten',
+                'displayType': '`Option`<`Option`<`T`>> -> `Option`<`T`>',
+            },
+        ],
+    },
+    {
+        'query': 'option<t>',
+        'returned': [
+            {
+                'path': 'std::result::Result',
+                'name': 'ok',
+                'displayType': 'Result<T, E> -> `Option`<`T`>',
+            },
+        ],
+    },
+    {
+        'query': 'option<t>, (fnonce () -> u) -> option',
+        'others': [
+            {
+                'path': 'std::option::Option',
+                'name': 'map',
+                'displayType': '`Option`<`T`>, F -> `Option`<U>',
+                'displayMappedNames': `t = T, u = U`,
+                'displayWhereClause': "F: `FnOnce` (T) -> `U`",
+            },
+            {
+                'path': 'std::option::Option',
+                'name': 'and_then',
+                'displayType': '`Option`<`T`>, F -> `Option`<U>',
+                'displayMappedNames': `t = T, u = U`,
+                'displayWhereClause': "F: `FnOnce` (T) -> Option<`U`>",
+            },
+            {
+                'path': 'std::option::Option',
+                'name': 'zip_with',
+                'displayType': 'Option<T>, `Option`<`U`>, F -> `Option`<R>',
+                'displayMappedNames': `t = U, u = R`,
+                'displayWhereClause': "F: `FnOnce` (T, U) -> `R`",
+            },
+        ],
+    },
+    {
+        'query': 'option<t>, (fnonce () -> option<u>) -> option',
+        'others': [
+            {
+                'path': 'std::option::Option',
+                'name': 'and_then',
+                'displayType': '`Option`<`T`>, F -> `Option`<U>',
+                'displayMappedNames': `t = T, u = U`,
+                'displayWhereClause': "F: `FnOnce` (T) -> `Option`<`U`>",
+            },
+        ],
+    },
+];
diff --git a/tests/rustdoc-js-std/osstring-to-string.js b/tests/rustdoc-js-std/osstring-to-string.js
new file mode 100644
index 00000000000..17bb602a502
--- /dev/null
+++ b/tests/rustdoc-js-std/osstring-to-string.js
@@ -0,0 +1,9 @@
+// exact-match
+
+// https://github.com/rust-lang/rust/issues/60485#issuecomment-663900624
+const EXPECTED = {
+    'query': 'OsString -> String',
+    'others': [
+        { 'path': 'std::ffi::OsString', 'name': 'into_string' },
+    ]
+};
diff --git a/tests/rustdoc-js-std/parser-bindings.js b/tests/rustdoc-js-std/parser-bindings.js
new file mode 100644
index 00000000000..bd379f139ff
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-bindings.js
@@ -0,0 +1,237 @@
+const PARSED = [
+    {
+        query: 'A<B=C>',
+        elems: [
+            {
+                name: "A",
+                fullPath: ["a"],
+                pathWithoutLast: [],
+                pathLast: "a",
+                normalizedPathLast: "a",
+                generics: [],
+                bindings: [
+                    [
+                        'b',
+                        [
+                            {
+                                name: "C",
+                                fullPath: ["c"],
+                                pathWithoutLast: [],
+                                pathLast: "c",
+                                normalizedPathLast: "c",
+                                generics: [],
+                                typeFilter: -1,
+                            },
+                        ]
+                    ],
+                ],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: 'A<B=C>',
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'A<B = C>',
+        elems: [
+            {
+                name: "A",
+                fullPath: ["a"],
+                pathWithoutLast: [],
+                pathLast: "a",
+                generics: [],
+                bindings: [
+                    [
+                        'b',
+                        [{
+                            name: "C",
+                            fullPath: ["c"],
+                            pathWithoutLast: [],
+                            pathLast: "c",
+                            generics: [],
+                            typeFilter: -1,
+                        }]
+                    ],
+                ],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: 'A<B = C>',
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'A<B=!>',
+        elems: [
+            {
+                name: "A",
+                fullPath: ["a"],
+                pathWithoutLast: [],
+                pathLast: "a",
+                generics: [],
+                bindings: [
+                    [
+                        'b',
+                        [{
+                            name: "never",
+                            fullPath: ["never"],
+                            pathWithoutLast: [],
+                            pathLast: "never",
+                            generics: [],
+                            typeFilter: 1,
+                        }]
+                    ],
+                ],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: 'A<B=!>',
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'A<B=[]>',
+        elems: [
+            {
+                name: "A",
+                fullPath: ["a"],
+                pathWithoutLast: [],
+                pathLast: "a",
+                generics: [],
+                bindings: [
+                    [
+                        'b',
+                        [{
+                            name: "[]",
+                            fullPath: ["[]"],
+                            pathWithoutLast: [],
+                            pathLast: "[]",
+                            generics: [],
+                            typeFilter: 1,
+                        }]
+                    ],
+                ],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: 'A<B=[]>',
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'A<B=[!]>',
+        elems: [
+            {
+                name: "A",
+                fullPath: ["a"],
+                pathWithoutLast: [],
+                pathLast: "a",
+                generics: [],
+                bindings: [
+                    [
+                        'b',
+                        [{
+                            name: "[]",
+                            fullPath: ["[]"],
+                            pathWithoutLast: [],
+                            pathLast: "[]",
+                            generics: [
+                                {
+                                    name: "never",
+                                    fullPath: ["never"],
+                                    pathWithoutLast: [],
+                                    pathLast: "never",
+                                    generics: [],
+                                    typeFilter: 1,
+                                },
+                            ],
+                            typeFilter: 1,
+                        }]
+                    ],
+                ],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: 'A<B=[!]>',
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'A<B=C=>',
+        elems: [],
+        foundElems: 0,
+        userQuery: 'A<B=C=>',
+        returned: [],
+        error: "Cannot write `=` twice in a binding",
+    },
+    {
+        query: 'A<B=>',
+        elems: [],
+        foundElems: 0,
+        userQuery: 'A<B=>',
+        returned: [],
+        error: "Unexpected `>` after `=`",
+    },
+    {
+        query: 'B=C',
+        elems: [],
+        foundElems: 0,
+        userQuery: 'B=C',
+        returned: [],
+        error: "Type parameter `=` must be within generics list",
+    },
+    {
+        query: '[B=C]',
+        elems: [],
+        foundElems: 0,
+        userQuery: '[B=C]',
+        returned: [],
+        error: "Type parameter `=` cannot be within slice `[]`",
+    },
+    {
+        query: 'A<B<X>=C>',
+        elems: [
+            {
+                name: "A",
+                fullPath: ["a"],
+                pathWithoutLast: [],
+                pathLast: "a",
+                generics: [],
+                bindings: [
+                    [
+                        'b',
+                        [
+                            {
+                                name: "C",
+                                fullPath: ["c"],
+                                pathWithoutLast: [],
+                                pathLast: "c",
+                                generics: [],
+                                typeFilter: -1,
+                            },
+                            {
+                                name: "X",
+                                fullPath: ["x"],
+                                pathWithoutLast: [],
+                                pathLast: "x",
+                                generics: [],
+                                typeFilter: -1,
+                            },
+                        ],
+                    ],
+                ],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: 'A<B<X>=C>',
+        returned: [],
+        error: null,
+    },
+];
diff --git a/tests/rustdoc-js-std/parser-errors.js b/tests/rustdoc-js-std/parser-errors.js
new file mode 100644
index 00000000000..8bffef61c8f
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-errors.js
@@ -0,0 +1,495 @@
+const PARSED = [
+    {
+        query: '<P>',
+        elems: [],
+        foundElems: 0,
+        userQuery: "<P>",
+        returned: [],
+        error: "Found generics without a path",
+    },
+    {
+        query: '-> <P>',
+        elems: [],
+        foundElems: 0,
+        userQuery: "-> <P>",
+        returned: [],
+        error: "Found generics without a path",
+    },
+    {
+        query: '-> *',
+        elems: [],
+        foundElems: 0,
+        userQuery: "-> *",
+        returned: [],
+        error: "Unexpected `*` after ` ` (not a valid identifier)",
+    },
+    {
+        query: 'a<"P">',
+        elems: [],
+        foundElems: 0,
+        userQuery: "a<\"P\">",
+        returned: [],
+        error: "Unexpected `\"` in generics",
+    },
+    {
+        query: '"P" "P"',
+        elems: [],
+        foundElems: 0,
+        userQuery: "\"P\" \"P\"",
+        returned: [],
+        error: "Cannot have more than one element if you use quotes",
+    },
+    {
+        query: '"P","P"',
+        elems: [],
+        foundElems: 0,
+        userQuery: "\"P\",\"P\"",
+        returned: [],
+        error: "Cannot have more than one literal search element",
+    },
+    {
+        query: "P,\"P\"",
+        elems: [],
+        foundElems: 0,
+        userQuery: "P,\"P\"",
+        returned: [],
+        error: "Cannot use literal search when there is more than one element",
+    },
+    {
+        query: '"p" p',
+        elems: [],
+        foundElems: 0,
+        userQuery: "\"p\" p",
+        returned: [],
+        error: "Cannot have more than one element if you use quotes",
+    },
+    {
+        query: '"p",p',
+        elems: [],
+        foundElems: 0,
+        userQuery: "\"p\",p",
+        returned: [],
+        error: "Cannot have more than one element if you use quotes",
+    },
+    {
+        query: '"const": p',
+        elems: [],
+        foundElems: 0,
+        userQuery: "\"const\": p",
+        returned: [],
+        error: "Cannot use quotes on type filter",
+    },
+    {
+        query: "a<:a>",
+        elems: [],
+        foundElems: 0,
+        userQuery: "a<:a>",
+        returned: [],
+        error: "Expected type filter before `:`",
+    },
+    {
+        query: "a<::a>",
+        elems: [],
+        foundElems: 0,
+        userQuery: "a<::a>",
+        returned: [],
+        error: "Unexpected `::`: paths cannot start with `::`",
+    },
+    {
+        query: "(p -> p",
+        elems: [],
+        foundElems: 0,
+        userQuery: "(p -> p",
+        returned: [],
+        error: "Unclosed `(`",
+    },
+    {
+        query: "::a::b",
+        elems: [],
+        foundElems: 0,
+        userQuery: "::a::b",
+        returned: [],
+        error: "Paths cannot start with `::`",
+    },
+    {
+        query: " ::a::b",
+        elems: [],
+        foundElems: 0,
+        userQuery: "::a::b",
+        returned: [],
+        error: "Paths cannot start with `::`",
+    },
+    {
+        query: "a::::b",
+        elems: [],
+        foundElems: 0,
+        userQuery: "a::::b",
+        returned: [],
+        error: "Unexpected `::::`",
+    },
+    {
+        query: "a:: ::b",
+        elems: [],
+        foundElems: 0,
+        userQuery: "a:: ::b",
+        returned: [],
+        error: "Unexpected `:: ::`",
+    },
+    {
+        query: "a::\t::b",
+        elems: [],
+        foundElems: 0,
+        userQuery: "a:: ::b",
+        returned: [],
+        error: "Unexpected `:: ::`",
+    },
+    {
+        query: ":a",
+        elems: [],
+        foundElems: 0,
+        userQuery: ":a",
+        returned: [],
+        error: "Expected type filter before `:`",
+    },
+    {
+        query: "a,b:",
+        elems: [],
+        foundElems: 0,
+        userQuery: "a,b:",
+        returned: [],
+        error: "Unexpected `:` (expected path after type filter `b:`)",
+    },
+    {
+        query: "a (b:",
+        elems: [],
+        foundElems: 0,
+        userQuery: "a (b:",
+        returned: [],
+        error: "Unclosed `(`",
+    },
+    {
+        query: "_:",
+        elems: [],
+        foundElems: 0,
+        userQuery: "_:",
+        returned: [],
+        error: "Unexpected `_` (not a valid identifier)",
+    },
+    {
+        query: "ab:",
+        elems: [],
+        foundElems: 0,
+        userQuery: "ab:",
+        returned: [],
+        error: "Unexpected `:` (expected path after type filter `ab:`)",
+    },
+    {
+        query: "a:b",
+        elems: [],
+        foundElems: 0,
+        userQuery: "a:b",
+        returned: [],
+        error: "Unknown type filter `a`",
+    },
+    {
+        query: "a-bb",
+        elems: [],
+        foundElems: 0,
+        userQuery: "a-bb",
+        returned: [],
+        error: "Unexpected `-` (did you mean `->`?)",
+    },
+    {
+        query: "a>bb",
+        elems: [],
+        foundElems: 0,
+        userQuery: "a>bb",
+        returned: [],
+        error: "Unexpected `>` (did you mean `->`?)",
+    },
+    {
+        query: "ab'",
+        elems: [],
+        foundElems: 0,
+        userQuery: "ab'",
+        returned: [],
+        error: "Unexpected `'` after `b` (not a valid identifier)",
+    },
+    {
+        query: '"p" <a>',
+        elems: [],
+        foundElems: 0,
+        userQuery: '"p" <a>',
+        returned: [],
+        error: "Cannot have more than one element if you use quotes",
+    },
+    {
+        query: '"p",<a>',
+        elems: [],
+        foundElems: 0,
+        userQuery: '"p",<a>',
+        returned: [],
+        error: "Found generics without a path",
+    },
+    {
+        query: '"p" a<a>',
+        elems: [],
+        foundElems: 0,
+        userQuery: '"p" a<a>',
+        returned: [],
+        error: "Cannot have more than one element if you use quotes",
+    },
+    {
+        query: '"p",a<a>',
+        elems: [],
+        foundElems: 0,
+        userQuery: '"p",a<a>',
+        returned: [],
+        error: "Cannot have more than one element if you use quotes",
+    },
+    {
+        query: "a,<",
+        elems: [],
+        foundElems: 0,
+        userQuery: 'a,<',
+        returned: [],
+        error: 'Found generics without a path',
+    },
+    {
+        query: "aaaaa<>b",
+        elems: [],
+        foundElems: 0,
+        userQuery: 'aaaaa<>b',
+        returned: [],
+        error: 'Expected `,`, `:` or `->` after `>`, found `b`',
+    },
+    {
+        query: "fn:aaaaa<>b",
+        elems: [],
+        foundElems: 0,
+        userQuery: 'fn:aaaaa<>b',
+        returned: [],
+        error: 'Expected `,`, `:` or `->` after `>`, found `b`',
+    },
+    {
+        query: "->a<>b",
+        elems: [],
+        foundElems: 0,
+        userQuery: '->a<>b',
+        returned: [],
+        error: 'Expected `,` or `=` after `>`, found `b`',
+    },
+    {
+        query: "a<->",
+        elems: [],
+        foundElems: 0,
+        userQuery: 'a<->',
+        returned: [],
+        error: 'Unclosed `<`',
+    },
+    {
+        query: "a<a>:",
+        elems: [],
+        foundElems: 0,
+        userQuery: "a<a>:",
+        returned: [],
+        error: 'Unexpected `<` in type filter (before `:`)',
+    },
+    {
+        query: "a<>:",
+        elems: [],
+        foundElems: 0,
+        userQuery: "a<>:",
+        returned: [],
+        error: 'Unexpected `<` in type filter (before `:`)',
+    },
+    {
+        query: "a,:",
+        elems: [],
+        foundElems: 0,
+        userQuery: "a,:",
+        returned: [],
+        error: 'Expected type filter before `:`',
+    },
+    {
+        query: "a!:",
+        elems: [],
+        foundElems: 0,
+        userQuery: "a!:",
+        returned: [],
+        error: 'Unexpected `!` in type filter (before `:`)',
+    },
+    {
+        query: "  a<>  :",
+        elems: [],
+        foundElems: 0,
+        userQuery: "a<>  :",
+        returned: [],
+        error: 'Expected `,`, `:` or `->` after `>`, found `:`',
+    },
+    {
+        query: "mod : :",
+        elems: [],
+        foundElems: 0,
+        userQuery: "mod : :",
+        returned: [],
+        error: 'Unexpected `:` (expected path after type filter `mod:`)',
+    },
+    {
+        query: "mod: :",
+        elems: [],
+        foundElems: 0,
+        userQuery: "mod: :",
+        returned: [],
+        error: 'Unexpected `:` (expected path after type filter `mod:`)',
+    },
+    {
+        query: "a!a",
+        elems: [],
+        foundElems: 0,
+        userQuery: "a!a",
+        returned: [],
+        error: 'Unexpected `!`: it can only be at the end of an ident',
+    },
+    {
+        query: "a!!",
+        elems: [],
+        foundElems: 0,
+        userQuery: "a!!",
+        returned: [],
+        error: 'Cannot have more than one `!` in an ident',
+    },
+    {
+        query: "mod:a!",
+        elems: [],
+        foundElems: 0,
+        userQuery: "mod:a!",
+        returned: [],
+        error: 'Invalid search type: macro `!` and `mod` both specified',
+    },
+    {
+        query: "mod:!",
+        elems: [],
+        foundElems: 0,
+        userQuery: "mod:!",
+        returned: [],
+        error: 'Invalid search type: primitive never type `!` and `mod` both specified',
+    },
+    {
+        query: "a!::a",
+        elems: [],
+        foundElems: 0,
+        userQuery: "a!::a",
+        returned: [],
+        error: 'Cannot have associated items in macros',
+    },
+    {
+        query: "a<",
+        elems: [],
+        foundElems: 0,
+        userQuery: "a<",
+        returned: [],
+        error: "Unclosed `<`",
+    },
+    {
+        query: "p<x> , y",
+        elems: [
+            {
+                name: "p",
+                fullPath: ["p"],
+                pathWithoutLast: [],
+                pathLast: "p",
+                generics: [
+                    {
+                        name: "x",
+                        fullPath: ["x"],
+                        pathWithoutLast: [],
+                        pathLast: "x",
+                        generics: [],
+                        typeFilter: -1,
+                    },
+                ],
+                typeFilter: -1,
+            },
+            {
+                name: "y",
+                fullPath: ["y"],
+                pathWithoutLast: [],
+                pathLast: "y",
+                generics: [],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 2,
+        userQuery: "p<x> , y",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "p<x , y>",
+        elems: [
+            {
+                name: "p",
+                fullPath: ["p"],
+                pathWithoutLast: [],
+                pathLast: "p",
+                generics: [
+                    {
+                        name: "x",
+                        fullPath: ["x"],
+                        pathWithoutLast: [],
+                        pathLast: "x",
+                        generics: [],
+                        typeFilter: -1,
+                    },
+                    {
+                        name: "y",
+                        fullPath: ["y"],
+                        pathWithoutLast: [],
+                        pathLast: "y",
+                        generics: [],
+                        typeFilter: -1,
+                    },
+                ],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "p<x , y>",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "p ,x , y",
+        elems: [
+            {
+                name: "p",
+                fullPath: ["p"],
+                pathWithoutLast: [],
+                pathLast: "p",
+                generics: [],
+                typeFilter: -1,
+            },
+            {
+                name: "x",
+                fullPath: ["x"],
+                pathWithoutLast: [],
+                pathLast: "x",
+                generics: [],
+                typeFilter: -1,
+            },
+            {
+                name: "y",
+                fullPath: ["y"],
+                pathWithoutLast: [],
+                pathLast: "y",
+                generics: [],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 3,
+        userQuery: "p ,x , y",
+        returned: [],
+        error: null,
+    },
+];
diff --git a/tests/rustdoc-js-std/parser-filter.js b/tests/rustdoc-js-std/parser-filter.js
new file mode 100644
index 00000000000..cda950461f7
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-filter.js
@@ -0,0 +1,156 @@
+const PARSED = [
+    {
+        query: 'fn:foo',
+        elems: [{
+            name: "foo",
+            fullPath: ["foo"],
+            pathWithoutLast: [],
+            pathLast: "foo",
+            generics: [],
+            typeFilter: 7,
+        }],
+        foundElems: 1,
+        userQuery: "fn:foo",
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'enum : foo',
+        elems: [{
+            name: "foo",
+            fullPath: ["foo"],
+            pathWithoutLast: [],
+            pathLast: "foo",
+            generics: [],
+            typeFilter: 6,
+        }],
+        foundElems: 1,
+        userQuery: "enum : foo",
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'macro<f>:foo',
+        elems: [],
+        foundElems: 0,
+        userQuery: "macro<f>:foo",
+        returned: [],
+        error: "Unexpected `<` in type filter (before `:`)",
+    },
+    {
+        query: 'macro!',
+        elems: [{
+            name: "macro",
+            fullPath: ["macro"],
+            pathWithoutLast: [],
+            pathLast: "macro",
+            generics: [],
+            typeFilter: 16,
+        }],
+        foundElems: 1,
+        userQuery: "macro!",
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'macro:mac!',
+        elems: [{
+            name: "mac",
+            fullPath: ["mac"],
+            pathWithoutLast: [],
+            pathLast: "mac",
+            generics: [],
+            typeFilter: 16,
+        }],
+        foundElems: 1,
+        userQuery: "macro:mac!",
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'a::mac!',
+        elems: [{
+            name: "a::mac",
+            fullPath: ["a", "mac"],
+            pathWithoutLast: ["a"],
+            pathLast: "mac",
+            generics: [],
+            typeFilter: 16,
+        }],
+        foundElems: 1,
+        userQuery: "a::mac!",
+        returned: [],
+        error: null,
+    },
+    {
+        query: '-> fn:foo',
+        elems: [],
+        foundElems: 1,
+        userQuery: "-> fn:foo",
+        returned: [{
+            name: "foo",
+            fullPath: ["foo"],
+            pathWithoutLast: [],
+            pathLast: "foo",
+            generics: [],
+            typeFilter: 7,
+        }],
+        error: null,
+    },
+    {
+        query: '-> fn:foo<fn:bar>',
+        elems: [],
+        foundElems: 1,
+        userQuery: "-> fn:foo<fn:bar>",
+        returned: [{
+            name: "foo",
+            fullPath: ["foo"],
+            pathWithoutLast: [],
+            pathLast: "foo",
+            generics: [
+                {
+                    name: "bar",
+                    fullPath: ["bar"],
+                    pathWithoutLast: [],
+                    pathLast: "bar",
+                    generics: [],
+                    typeFilter: 7,
+                }
+            ],
+            typeFilter: 7,
+        }],
+        error: null,
+    },
+    {
+        query: '-> fn:foo<fn:bar, enum : baz::fuzz>',
+        elems: [],
+        foundElems: 1,
+        userQuery: "-> fn:foo<fn:bar, enum : baz::fuzz>",
+        returned: [{
+            name: "foo",
+            fullPath: ["foo"],
+            pathWithoutLast: [],
+            pathLast: "foo",
+            generics: [
+                {
+                    name: "bar",
+                    fullPath: ["bar"],
+                    pathWithoutLast: [],
+                    pathLast: "bar",
+                    generics: [],
+                    typeFilter: 7,
+                },
+                {
+                    name: "baz::fuzz",
+                    fullPath: ["baz", "fuzz"],
+                    pathWithoutLast: ["baz"],
+                    pathLast: "fuzz",
+                    generics: [],
+                    typeFilter: 6,
+                },
+            ],
+            typeFilter: 7,
+        }],
+        error: null,
+    },
+];
diff --git a/tests/rustdoc-js-std/parser-generics.js b/tests/rustdoc-js-std/parser-generics.js
new file mode 100644
index 00000000000..8b8d95bcb88
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-generics.js
@@ -0,0 +1,173 @@
+const PARSED = [
+    {
+        query: 'A<B<C<D>,  E>',
+        elems: [],
+        foundElems: 0,
+        userQuery: 'A<B<C<D>,  E>',
+        returned: [],
+        error: 'Unclosed `<`',
+    },
+    {
+        query: 'p<>,u8',
+        elems: [
+            {
+                name: "p",
+                fullPath: ["p"],
+                pathWithoutLast: [],
+                pathLast: "p",
+                generics: [],
+                typeFilter: -1,
+            },
+            {
+                name: "u8",
+                fullPath: ["u8"],
+                pathWithoutLast: [],
+                pathLast: "u8",
+                generics: [],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 2,
+        userQuery: "p<>,u8",
+        returned: [],
+        error: null,
+    },
+    {
+        query: '"p"<a>',
+        elems: [
+            {
+                name: "p",
+                fullPath: ["p"],
+                pathWithoutLast: [],
+                pathLast: "p",
+                generics: [
+                    {
+                        name: "a",
+                        fullPath: ["a"],
+                        pathWithoutLast: [],
+                        pathLast: "a",
+                        generics: [],
+                    },
+                ],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: '"p"<a>',
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'p<u<x>>',
+        elems: [
+            {
+                name: "p",
+                fullPath: ["p"],
+                pathWithoutLast: [],
+                pathLast: "p",
+                generics: [
+                    {
+                        name: "u",
+                        fullPath: ["u"],
+                        pathWithoutLast: [],
+                        pathLast: "u",
+                        generics: [
+                            {
+                                name: "x",
+                                fullPath: ["x"],
+                                pathWithoutLast: [],
+                                pathLast: "x",
+                                generics: [],
+                            },
+                        ],
+                    },
+                ],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: 'p<u<x>>',
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'p<u<x>, r>',
+        elems: [
+            {
+                name: "p",
+                fullPath: ["p"],
+                pathWithoutLast: [],
+                pathLast: "p",
+                generics: [
+                    {
+                        name: "u",
+                        fullPath: ["u"],
+                        pathWithoutLast: [],
+                        pathLast: "u",
+                        generics: [
+                            {
+                                name: "x",
+                                fullPath: ["x"],
+                                pathWithoutLast: [],
+                                pathLast: "x",
+                                generics: [],
+                            },
+                        ],
+                    },
+                    {
+                        name: "r",
+                        fullPath: ["r"],
+                        pathWithoutLast: [],
+                        pathLast: "r",
+                        generics: [],
+                    },
+                ],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: 'p<u<x>, r>',
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'p<u<x, r>>',
+        elems: [
+            {
+                name: "p",
+                fullPath: ["p"],
+                pathWithoutLast: [],
+                pathLast: "p",
+                generics: [
+                    {
+                        name: "u",
+                        fullPath: ["u"],
+                        pathWithoutLast: [],
+                        pathLast: "u",
+                        generics: [
+                            {
+                                name: "x",
+                                fullPath: ["x"],
+                                pathWithoutLast: [],
+                                pathLast: "x",
+                                generics: [],
+                            },
+                            {
+                                name: "r",
+                                fullPath: ["r"],
+                                pathWithoutLast: [],
+                                pathLast: "r",
+                                generics: [],
+                            },
+                        ],
+                    },
+                ],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: 'p<u<x, r>>',
+        returned: [],
+        error: null,
+    },
+];
diff --git a/tests/rustdoc-js-std/parser-hof.js b/tests/rustdoc-js-std/parser-hof.js
new file mode 100644
index 00000000000..ca761015412
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-hof.js
@@ -0,0 +1,694 @@
+const PARSED = [
+    // ML-style HOF
+    {
+        query: "(-> F<P>)",
+        elems: [{
+            name: "->",
+            fullPath: ["->"],
+            pathWithoutLast: [],
+            pathLast: "->",
+            generics: [],
+            bindings: [
+                [
+                    "output",
+                    [{
+                        name: "F",
+                        fullPath: ["f"],
+                        pathWithoutLast: [],
+                        pathLast: "f",
+                        generics: [
+                            {
+                                name: "P",
+                                fullPath: ["p"],
+                                pathWithoutLast: [],
+                                pathLast: "p",
+                                generics: [],
+                            },
+                        ],
+                        typeFilter: -1,
+                    }],
+                ],
+            ],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        userQuery: "(-> F<P>)",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "(-> P)",
+        elems: [{
+            name: "->",
+            fullPath: ["->"],
+            pathWithoutLast: [],
+            pathLast: "->",
+            generics: [],
+            bindings: [
+                [
+                    "output",
+                    [{
+                        name: "P",
+                        fullPath: ["p"],
+                        pathWithoutLast: [],
+                        pathLast: "p",
+                        generics: [],
+                        typeFilter: -1,
+                    }],
+                ],
+            ],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        userQuery: "(-> P)",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "(->,a)",
+        elems: [{
+            name: "->",
+            fullPath: ["->"],
+            pathWithoutLast: [],
+            pathLast: "->",
+            generics: [],
+            bindings: [
+                [
+                    "output",
+                    [{
+                        name: "a",
+                        fullPath: ["a"],
+                        pathWithoutLast: [],
+                        pathLast: "a",
+                        generics: [],
+                        typeFilter: -1,
+                    }],
+                ],
+            ],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        userQuery: "(->,a)",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "(F<P> ->)",
+        elems: [{
+            name: "->",
+            fullPath: ["->"],
+            pathWithoutLast: [],
+            pathLast: "->",
+            generics: [{
+                name: "F",
+                fullPath: ["f"],
+                pathWithoutLast: [],
+                pathLast: "f",
+                generics: [
+                    {
+                        name: "P",
+                        fullPath: ["p"],
+                        pathWithoutLast: [],
+                        pathLast: "p",
+                        generics: [],
+                    },
+                ],
+                typeFilter: -1,
+            }],
+            bindings: [
+                [
+                    "output",
+                    [],
+                ],
+            ],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        userQuery: "(F<P> ->)",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "(P ->)",
+        elems: [{
+            name: "->",
+            fullPath: ["->"],
+            pathWithoutLast: [],
+            pathLast: "->",
+            generics: [{
+                name: "P",
+                fullPath: ["p"],
+                pathWithoutLast: [],
+                pathLast: "p",
+                generics: [],
+                typeFilter: -1,
+            }],
+            bindings: [
+                [
+                    "output",
+                    [],
+                ],
+            ],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        userQuery: "(P ->)",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "(,a->)",
+        elems: [{
+            name: "->",
+            fullPath: ["->"],
+            pathWithoutLast: [],
+            pathLast: "->",
+            generics: [{
+                name: "a",
+                fullPath: ["a"],
+                pathWithoutLast: [],
+                pathLast: "a",
+                generics: [],
+                typeFilter: -1,
+            }],
+            bindings: [
+                [
+                    "output",
+                    [],
+                ],
+            ],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        userQuery: "(,a->)",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "(aaaaa->a)",
+        elems: [{
+            name: "->",
+            fullPath: ["->"],
+            pathWithoutLast: [],
+            pathLast: "->",
+            generics: [{
+                name: "aaaaa",
+                fullPath: ["aaaaa"],
+                pathWithoutLast: [],
+                pathLast: "aaaaa",
+                generics: [],
+                typeFilter: -1,
+            }],
+            bindings: [
+                [
+                    "output",
+                    [{
+                        name: "a",
+                        fullPath: ["a"],
+                        pathWithoutLast: [],
+                        pathLast: "a",
+                        generics: [],
+                        typeFilter: -1,
+                    }],
+                ],
+            ],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        userQuery: "(aaaaa->a)",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "(aaaaa, b -> a)",
+        elems: [{
+            name: "->",
+            fullPath: ["->"],
+            pathWithoutLast: [],
+            pathLast: "->",
+            generics: [
+                {
+                    name: "aaaaa",
+                    fullPath: ["aaaaa"],
+                    pathWithoutLast: [],
+                    pathLast: "aaaaa",
+                    generics: [],
+                    typeFilter: -1,
+                },
+                {
+                    name: "b",
+                    fullPath: ["b"],
+                    pathWithoutLast: [],
+                    pathLast: "b",
+                    generics: [],
+                    typeFilter: -1,
+                },
+            ],
+            bindings: [
+                [
+                    "output",
+                    [{
+                        name: "a",
+                        fullPath: ["a"],
+                        pathWithoutLast: [],
+                        pathLast: "a",
+                        generics: [],
+                        typeFilter: -1,
+                    }],
+                ],
+            ],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        userQuery: "(aaaaa, b -> a)",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "primitive:(aaaaa, b -> a)",
+        elems: [{
+            name: "->",
+            fullPath: ["->"],
+            pathWithoutLast: [],
+            pathLast: "->",
+            generics: [
+                {
+                    name: "aaaaa",
+                    fullPath: ["aaaaa"],
+                    pathWithoutLast: [],
+                    pathLast: "aaaaa",
+                    generics: [],
+                    typeFilter: -1,
+                },
+                {
+                    name: "b",
+                    fullPath: ["b"],
+                    pathWithoutLast: [],
+                    pathLast: "b",
+                    generics: [],
+                    typeFilter: -1,
+                },
+            ],
+            bindings: [
+                [
+                    "output",
+                    [{
+                        name: "a",
+                        fullPath: ["a"],
+                        pathWithoutLast: [],
+                        pathLast: "a",
+                        generics: [],
+                        typeFilter: -1,
+                    }],
+                ],
+            ],
+            typeFilter: 1,
+        }],
+        foundElems: 1,
+        userQuery: "primitive:(aaaaa, b -> a)",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "x, trait:(aaaaa, b -> a)",
+        elems: [
+            {
+                name: "x",
+                fullPath: ["x"],
+                pathWithoutLast: [],
+                pathLast: "x",
+                generics: [],
+                typeFilter: -1,
+            },
+            {
+                name: "->",
+                fullPath: ["->"],
+                pathWithoutLast: [],
+                pathLast: "->",
+                generics: [
+                    {
+                        name: "aaaaa",
+                        fullPath: ["aaaaa"],
+                        pathWithoutLast: [],
+                        pathLast: "aaaaa",
+                        generics: [],
+                        typeFilter: -1,
+                    },
+                    {
+                        name: "b",
+                        fullPath: ["b"],
+                        pathWithoutLast: [],
+                        pathLast: "b",
+                        generics: [],
+                        typeFilter: -1,
+                    },
+                ],
+                bindings: [
+                    [
+                        "output",
+                        [{
+                            name: "a",
+                            fullPath: ["a"],
+                            pathWithoutLast: [],
+                            pathLast: "a",
+                            generics: [],
+                            typeFilter: -1,
+                        }],
+                    ],
+                ],
+                typeFilter: 10,
+            }
+        ],
+        foundElems: 2,
+        userQuery: "x, trait:(aaaaa, b -> a)",
+        returned: [],
+        error: null,
+    },
+    // Rust-style HOF
+    {
+        query: "Fn () -> F<P>",
+        elems: [{
+            name: "Fn",
+            fullPath: ["fn"],
+            pathWithoutLast: [],
+            pathLast: "fn",
+            generics: [],
+            bindings: [
+                [
+                    "output",
+                    [{
+                        name: "F",
+                        fullPath: ["f"],
+                        pathWithoutLast: [],
+                        pathLast: "f",
+                        generics: [
+                            {
+                                name: "P",
+                                fullPath: ["p"],
+                                pathWithoutLast: [],
+                                pathLast: "p",
+                                generics: [],
+                            },
+                        ],
+                        typeFilter: -1,
+                    }],
+                ],
+            ],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        userQuery: "Fn () -> F<P>",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "FnMut() -> P",
+        elems: [{
+            name: "FnMut",
+            fullPath: ["fnmut"],
+            pathWithoutLast: [],
+            pathLast: "fnmut",
+            generics: [],
+            bindings: [
+                [
+                    "output",
+                    [{
+                        name: "P",
+                        fullPath: ["p"],
+                        pathWithoutLast: [],
+                        pathLast: "p",
+                        generics: [],
+                        typeFilter: -1,
+                    }],
+                ],
+            ],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        userQuery: "FnMut() -> P",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "(FnMut() -> P)",
+        elems: [{
+            name: "FnMut",
+            fullPath: ["fnmut"],
+            pathWithoutLast: [],
+            pathLast: "fnmut",
+            generics: [],
+            bindings: [
+                [
+                    "output",
+                    [{
+                        name: "P",
+                        fullPath: ["p"],
+                        pathWithoutLast: [],
+                        pathLast: "p",
+                        generics: [],
+                        typeFilter: -1,
+                    }],
+                ],
+            ],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        userQuery: "(FnMut() -> P)",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "Fn(F<P>)",
+        elems: [{
+            name: "Fn",
+            fullPath: ["fn"],
+            pathWithoutLast: [],
+            pathLast: "fn",
+            generics: [{
+                name: "F",
+                fullPath: ["f"],
+                pathWithoutLast: [],
+                pathLast: "f",
+                generics: [
+                    {
+                        name: "P",
+                        fullPath: ["p"],
+                        pathWithoutLast: [],
+                        pathLast: "p",
+                        generics: [],
+                    },
+                ],
+                typeFilter: -1,
+            }],
+            bindings: [
+                [
+                    "output",
+                    [],
+                ],
+            ],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        userQuery: "Fn(F<P>)",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "primitive:fnonce(aaaaa, b) -> a",
+        elems: [{
+            name: "fnonce",
+            fullPath: ["fnonce"],
+            pathWithoutLast: [],
+            pathLast: "fnonce",
+            generics: [
+                {
+                    name: "aaaaa",
+                    fullPath: ["aaaaa"],
+                    pathWithoutLast: [],
+                    pathLast: "aaaaa",
+                    generics: [],
+                    typeFilter: -1,
+                },
+                {
+                    name: "b",
+                    fullPath: ["b"],
+                    pathWithoutLast: [],
+                    pathLast: "b",
+                    generics: [],
+                    typeFilter: -1,
+                },
+            ],
+            bindings: [
+                [
+                    "output",
+                    [{
+                        name: "a",
+                        fullPath: ["a"],
+                        pathWithoutLast: [],
+                        pathLast: "a",
+                        generics: [],
+                        typeFilter: -1,
+                    }],
+                ],
+            ],
+            typeFilter: 1,
+        }],
+        foundElems: 1,
+        userQuery: "primitive:fnonce(aaaaa, b) -> a",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "primitive:fnonce(aaaaa, keyword:b) -> trait:a",
+        elems: [{
+            name: "fnonce",
+            fullPath: ["fnonce"],
+            pathWithoutLast: [],
+            pathLast: "fnonce",
+            generics: [
+                {
+                    name: "aaaaa",
+                    fullPath: ["aaaaa"],
+                    pathWithoutLast: [],
+                    pathLast: "aaaaa",
+                    generics: [],
+                    typeFilter: -1,
+                },
+                {
+                    name: "b",
+                    fullPath: ["b"],
+                    pathWithoutLast: [],
+                    pathLast: "b",
+                    generics: [],
+                    typeFilter: 0,
+                },
+            ],
+            bindings: [
+                [
+                    "output",
+                    [{
+                        name: "a",
+                        fullPath: ["a"],
+                        pathWithoutLast: [],
+                        pathLast: "a",
+                        generics: [],
+                        typeFilter: 10,
+                    }],
+                ],
+            ],
+            typeFilter: 1,
+        }],
+        foundElems: 1,
+        userQuery: "primitive:fnonce(aaaaa, keyword:b) -> trait:a",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "x, trait:fn(aaaaa, b -> a)",
+        elems: [
+            {
+                name: "x",
+                fullPath: ["x"],
+                pathWithoutLast: [],
+                pathLast: "x",
+                generics: [],
+                typeFilter: -1,
+            },
+            {
+                name: "fn",
+                fullPath: ["fn"],
+                pathWithoutLast: [],
+                pathLast: "fn",
+                generics: [
+                    {
+                        name: "->",
+                        fullPath: ["->"],
+                        pathWithoutLast: [],
+                        pathLast: "->",
+                        generics: [
+                            {
+                                name: "aaaaa",
+                                fullPath: ["aaaaa"],
+                                pathWithoutLast: [],
+                                pathLast: "aaaaa",
+                                generics: [],
+                                typeFilter: -1,
+                            },
+                            {
+                                name: "b",
+                                fullPath: ["b"],
+                                pathWithoutLast: [],
+                                pathLast: "b",
+                                generics: [],
+                                typeFilter: -1,
+                            },
+                        ],
+                        bindings: [
+                            [
+                                "output",
+                                [{
+                                    name: "a",
+                                    fullPath: ["a"],
+                                    pathWithoutLast: [],
+                                    pathLast: "a",
+                                    generics: [],
+                                    typeFilter: -1,
+                                }],
+                            ],
+                        ],
+                        typeFilter: -1,
+                    },
+                ],
+                bindings: [
+                    [
+                        "output",
+                        [],
+                    ]
+                ],
+                typeFilter: 10,
+            }
+        ],
+        foundElems: 2,
+        userQuery: "x, trait:fn(aaaaa, b -> a)",
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'a,b(c)',
+        elems: [
+            {
+                name: "a",
+                fullPath: ["a"],
+                pathWithoutLast: [],
+                pathLast: "a",
+                generics: [],
+                typeFilter: -1,
+            },
+            {
+                name: "b",
+                fullPath: ["b"],
+                pathWithoutLast: [],
+                pathLast: "b",
+                generics: [{
+                    name: "c",
+                    fullPath: ["c"],
+                    pathWithoutLast: [],
+                    pathLast: "c",
+                    generics: [],
+                    typeFilter: -1,
+                }],
+                bindings: [
+                    [
+                        "output",
+                        [],
+                    ]
+                ],
+                typeFilter: -1,
+            }
+        ],
+        foundElems: 2,
+        userQuery: "a,b(c)",
+        returned: [],
+        error: null,
+    },
+];
diff --git a/tests/rustdoc-js-std/parser-ident.js b/tests/rustdoc-js-std/parser-ident.js
new file mode 100644
index 00000000000..f65391b1571
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-ident.js
@@ -0,0 +1,143 @@
+const PARSED = [
+    {
+        query: "R<!>",
+        elems: [{
+            name: "R",
+            fullPath: ["r"],
+            pathWithoutLast: [],
+            pathLast: "r",
+            generics: [
+                {
+                    name: "never",
+                    fullPath: ["never"],
+                    pathWithoutLast: [],
+                    pathLast: "never",
+                    generics: [],
+                    typeFilter: 1,
+                },
+            ],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        userQuery: "R<!>",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "!",
+        elems: [{
+            name: "never",
+            fullPath: ["never"],
+            pathWithoutLast: [],
+            pathLast: "never",
+            generics: [],
+            typeFilter: 1,
+        }],
+        foundElems: 1,
+        userQuery: "!",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "a!",
+        elems: [{
+            name: "a",
+            fullPath: ["a"],
+            pathWithoutLast: [],
+            pathLast: "a",
+            generics: [],
+            typeFilter: 16,
+        }],
+        foundElems: 1,
+        userQuery: "a!",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "a!::b",
+        elems: [],
+        foundElems: 0,
+        userQuery: "a!::b",
+        returned: [],
+        error: "Cannot have associated items in macros",
+    },
+    {
+        query: "!<T>",
+        elems: [],
+        foundElems: 0,
+        userQuery: "!<T>",
+        returned: [],
+        error: "Never type `!` does not accept generic parameters",
+    },
+    {
+        query: "!::b",
+        elems: [{
+            name: "!::b",
+            fullPath: ["never", "b"],
+            pathWithoutLast: ["never"],
+            pathLast: "b",
+            generics: [],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        userQuery: "!::b",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "b::!",
+        elems: [],
+        foundElems: 0,
+        userQuery: "b::!",
+        returned: [],
+        error: "Never type `!` is not associated item",
+    },
+    {
+        query: "!::!",
+        elems: [],
+        foundElems: 0,
+        userQuery: "!::!",
+        returned: [],
+        error: "Never type `!` is not associated item",
+    },
+    {
+        query: "b::!::c",
+        elems: [],
+        foundElems: 0,
+        userQuery: "b::!::c",
+        returned: [],
+        error: "Never type `!` is not associated item",
+    },
+    {
+        query: "!::b<T>",
+        elems: [{
+            name: "!::b",
+            fullPath: ["never", "b"],
+            pathWithoutLast: ["never"],
+            pathLast: "b",
+            generics: [
+                {
+                    name: "T",
+                    fullPath: ["t"],
+                    pathWithoutLast: [],
+                    pathLast: "t",
+                    generics: [],
+                    typeFilter: -1,
+                }
+            ],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        userQuery: "!::b<T>",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "a!::b!",
+        elems: [],
+        foundElems: 0,
+        userQuery: "a!::b!",
+        returned: [],
+        error: "Cannot have associated items in macros",
+    },
+];
diff --git a/tests/rustdoc-js-std/parser-literal.js b/tests/rustdoc-js-std/parser-literal.js
new file mode 100644
index 00000000000..63e07a246a1
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-literal.js
@@ -0,0 +1,25 @@
+const PARSED = [
+    {
+        query: 'R<P>',
+        elems: [{
+            name: "R",
+            fullPath: ["r"],
+            pathWithoutLast: [],
+            pathLast: "r",
+            generics: [
+                {
+                    name: "P",
+                    fullPath: ["p"],
+                    pathWithoutLast: [],
+                    pathLast: "p",
+                    generics: [],
+                },
+            ],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        userQuery: "R<P>",
+        returned: [],
+        error: null,
+    }
+];
diff --git a/tests/rustdoc-js-std/parser-paths.js b/tests/rustdoc-js-std/parser-paths.js
new file mode 100644
index 00000000000..bb34e22e518
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-paths.js
@@ -0,0 +1,135 @@
+const PARSED = [
+    {
+        query: 'A::B',
+        elems: [{
+            name: "A::B",
+            fullPath: ["a", "b"],
+            pathWithoutLast: ["a"],
+            pathLast: "b",
+            generics: [],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        userQuery: "A::B",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "a:: a",
+        elems: [{
+            name: "a:: a",
+            fullPath: ["a", "a"],
+            pathWithoutLast: ["a"],
+            pathLast: "a",
+            generics: [],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        userQuery: 'a:: a',
+        returned: [],
+        error: null,
+    },
+    {
+        query: "a ::a",
+        elems: [{
+            name: "a ::a",
+            fullPath: ["a", "a"],
+            pathWithoutLast: ["a"],
+            pathLast: "a",
+            generics: [],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        userQuery: 'a ::a',
+        returned: [],
+        error: null,
+    },
+    {
+        query: "a  ::  a",
+        elems: [{
+            name: "a  ::  a",
+            fullPath: ["a", "a"],
+            pathWithoutLast: ["a"],
+            pathLast: "a",
+            generics: [],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        userQuery: 'a  ::  a',
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'A::B,C',
+        elems: [
+            {
+                name: "A::B",
+                fullPath: ["a", "b"],
+                pathWithoutLast: ["a"],
+                pathLast: "b",
+                generics: [],
+                typeFilter: -1,
+            },
+            {
+                name: "C",
+                fullPath: ["c"],
+                pathWithoutLast: [],
+                pathLast: "c",
+                generics: [],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 2,
+        userQuery: 'A::B,C',
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'A::B<f>,C',
+        elems: [
+            {
+                name: "A::B",
+                fullPath: ["a", "b"],
+                pathWithoutLast: ["a"],
+                pathLast: "b",
+                generics: [
+                    {
+                        name: "f",
+                        fullPath: ["f"],
+                        pathWithoutLast: [],
+                        pathLast: "f",
+                        generics: [],
+                    },
+                ],
+                typeFilter: -1,
+            },
+            {
+                name: "C",
+                fullPath: ["c"],
+                pathWithoutLast: [],
+                pathLast: "c",
+                generics: [],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 2,
+        userQuery: 'A::B<f>,C',
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'mod::a',
+        elems: [{
+            name: "mod::a",
+            fullPath: ["mod", "a"],
+            pathWithoutLast: ["mod"],
+            pathLast: "a",
+            generics: [],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        userQuery: "mod::a",
+        returned: [],
+        error: null,
+    },
+];
diff --git a/tests/rustdoc-js-std/parser-quote.js b/tests/rustdoc-js-std/parser-quote.js
new file mode 100644
index 00000000000..b485047e385
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-quote.js
@@ -0,0 +1,72 @@
+const PARSED = [
+    {
+        query: '-> "p"',
+        elems: [],
+        foundElems: 1,
+        userQuery: '-> "p"',
+        returned: [{
+            name: "p",
+            fullPath: ["p"],
+            pathWithoutLast: [],
+            pathLast: "p",
+            generics: [],
+            typeFilter: -1,
+        }],
+        error: null,
+    },
+    {
+        query: '"p",',
+        elems: [{
+            name: "p",
+            fullPath: ["p"],
+            pathWithoutLast: [],
+            pathLast: "p",
+            generics: [],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        userQuery: '"p",',
+        returned: [],
+        error: null,
+    },
+    {
+        query: '"p" -> a',
+        elems: [],
+        foundElems: 0,
+        userQuery: '"p" -> a',
+        returned: [],
+        error: "Cannot have more than one element if you use quotes",
+    },
+    {
+        query: '"a" -> "p"',
+        elems: [],
+        foundElems: 0,
+        userQuery: '"a" -> "p"',
+        returned: [],
+        error: "Cannot have more than one literal search element",
+    },
+    {
+        query: '->"-"',
+        elems: [],
+        foundElems: 0,
+        userQuery: '->"-"',
+        returned: [],
+        error: 'Unexpected `-` in a string element',
+    },
+    {
+        query: '"a',
+        elems: [],
+        foundElems: 0,
+        userQuery: '"a',
+        returned: [],
+        error: 'Unclosed `"`',
+    },
+    {
+        query: '""',
+        elems: [],
+        foundElems: 0,
+        userQuery: '""',
+        returned: [],
+        error: 'Cannot have empty string element',
+    },
+];
diff --git a/tests/rustdoc-js-std/parser-reference.js b/tests/rustdoc-js-std/parser-reference.js
new file mode 100644
index 00000000000..0fa07ae9895
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-reference.js
@@ -0,0 +1,510 @@
+const PARSED = [
+    {
+        query: '&[',
+        elems: [],
+        foundElems: 0,
+        userQuery: '&[',
+        returned: [],
+        error: 'Unclosed `[`',
+    },
+    {
+        query: '[&',
+        elems: [],
+        foundElems: 0,
+        userQuery: '[&',
+        returned: [],
+        error: 'Unclosed `[`',
+    },
+    {
+        query: '&&&D, []',
+        elems: [
+            {
+                name: "reference",
+                fullPath: ["reference"],
+                pathWithoutLast: [],
+                pathLast: "reference",
+                generics: [
+                    {
+                        name: "reference",
+                        fullPath: ["reference"],
+                        pathWithoutLast: [],
+                        pathLast: "reference",
+                        generics: [
+                            {
+                                name: "reference",
+                                fullPath: ["reference"],
+                                pathWithoutLast: [],
+                                pathLast: "reference",
+                                generics: [
+                                    {
+                                        name: "D",
+                                        fullPath: ["d"],
+                                        pathWithoutLast: [],
+                                        pathLast: "d",
+                                        generics: [],
+                                        typeFilter: -1,
+                                    },
+                                ],
+                                typeFilter: 1,
+                            },
+                        ],
+                        typeFilter: 1,
+                    },
+                ],
+                typeFilter: 1,
+            },
+            {
+                name: "[]",
+                fullPath: ["[]"],
+                pathWithoutLast: [],
+                pathLast: "[]",
+                generics: [],
+                typeFilter: 1,
+            },
+        ],
+        foundElems: 2,
+        userQuery: '&&&D, []',
+        returned: [],
+        error: null,
+    },
+    {
+        query: '&&&[D]',
+        elems: [
+            {
+                name: "reference",
+                fullPath: ["reference"],
+                pathWithoutLast: [],
+                pathLast: "reference",
+                generics: [
+                    {
+                        name: "reference",
+                        fullPath: ["reference"],
+                        pathWithoutLast: [],
+                        pathLast: "reference",
+                        generics: [
+                            {
+                                name: "reference",
+                                fullPath: ["reference"],
+                                pathWithoutLast: [],
+                                pathLast: "reference",
+                                generics: [
+                                    {
+                                        name: "[]",
+                                        fullPath: ["[]"],
+                                        pathWithoutLast: [],
+                                        pathLast: "[]",
+                                        generics: [
+                                            {
+                                                name: "D",
+                                                fullPath: ["d"],
+                                                pathWithoutLast: [],
+                                                pathLast: "d",
+                                                generics: [],
+                                                typeFilter: -1,
+                                            },
+                                        ],
+                                        typeFilter: 1,
+                                    },
+                                ],
+                                typeFilter: 1,
+                            },
+                        ],
+                        typeFilter: 1,
+                    },
+                ],
+                typeFilter: 1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: '&&&[D]',
+        returned: [],
+        error: null,
+    },
+    {
+        query: '&',
+        elems: [
+            {
+                name: "reference",
+                fullPath: ["reference"],
+                pathWithoutLast: [],
+                pathLast: "reference",
+                generics: [],
+                typeFilter: 1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: '&',
+        returned: [],
+        error: null,
+    },
+    {
+        query: '&mut',
+        elems: [
+            {
+                name: "reference",
+                fullPath: ["reference"],
+                pathWithoutLast: [],
+                pathLast: "reference",
+                generics: [
+                    {
+                        name: "mut",
+                        fullPath: ["mut"],
+                        pathWithoutLast: [],
+                        pathLast: "mut",
+                        generics: [],
+                        typeFilter: 0,
+                    },
+                ],
+                typeFilter: 1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: '&mut',
+        returned: [],
+        error: null,
+    },
+    {
+        query: '&,u8',
+        elems: [
+            {
+                name: "reference",
+                fullPath: ["reference"],
+                pathWithoutLast: [],
+                pathLast: "reference",
+                generics: [],
+                typeFilter: 1,
+            },
+            {
+                name: "u8",
+                fullPath: ["u8"],
+                pathWithoutLast: [],
+                pathLast: "u8",
+                generics: [],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 2,
+        userQuery: "&,u8",
+        returned: [],
+        error: null,
+    },
+    {
+        query: '&mut,u8',
+        elems: [
+            {
+                name: "reference",
+                fullPath: ["reference"],
+                pathWithoutLast: [],
+                pathLast: "reference",
+                generics: [
+                    {
+                        name: "mut",
+                        fullPath: ["mut"],
+                        pathWithoutLast: [],
+                        pathLast: "mut",
+                        generics: [],
+                        typeFilter: 0,
+                    },
+                ],
+                typeFilter: 1,
+            },
+            {
+                name: "u8",
+                fullPath: ["u8"],
+                pathWithoutLast: [],
+                pathLast: "u8",
+                generics: [],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 2,
+        userQuery: "&mut,u8",
+        returned: [],
+        error: null,
+    },
+    {
+        query: '&u8',
+        elems: [
+            {
+                name: "reference",
+                fullPath: ["reference"],
+                pathWithoutLast: [],
+                pathLast: "reference",
+                generics: [
+                    {
+                        name: "u8",
+                        fullPath: ["u8"],
+                        pathWithoutLast: [],
+                        pathLast: "u8",
+                        generics: [],
+                        typeFilter: -1,
+                    },
+                ],
+                typeFilter: 1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "&u8",
+        returned: [],
+        error: null,
+    },
+    {
+        query: '&u8<u8>',
+        elems: [
+            {
+                name: "reference",
+                fullPath: ["reference"],
+                pathWithoutLast: [],
+                pathLast: "reference",
+                generics: [
+                    {
+                        name: "u8",
+                        fullPath: ["u8"],
+                        pathWithoutLast: [],
+                        pathLast: "u8",
+                        generics: [
+                            {
+                                name: "u8",
+                                fullPath: ["u8"],
+                                pathWithoutLast: [],
+                                pathLast: "u8",
+                                generics: [],
+                                typeFilter: -1,
+                            },
+                        ],
+                        typeFilter: -1,
+                    },
+                ],
+                typeFilter: 1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "&u8<u8>",
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'u8<&u8>',
+        elems: [
+            {
+                name: "u8",
+                fullPath: ["u8"],
+                pathWithoutLast: [],
+                pathLast: "u8",
+                generics: [
+                    {
+                        name: "reference",
+                        fullPath: ["reference"],
+                        pathWithoutLast: [],
+                        pathLast: "reference",
+                        generics: [
+                            {
+                                name: "u8",
+                                fullPath: ["u8"],
+                                pathWithoutLast: [],
+                                pathLast: "u8",
+                                generics: [],
+                                typeFilter: -1,
+                            },
+                        ],
+                        typeFilter: 1,
+                    },
+                ],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "u8<&u8>",
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'u8<&u8, u8>',
+        elems: [
+            {
+                name: "u8",
+                fullPath: ["u8"],
+                pathWithoutLast: [],
+                pathLast: "u8",
+                generics: [
+                    {
+                        name: "reference",
+                        fullPath: ["reference"],
+                        pathWithoutLast: [],
+                        pathLast: "reference",
+                        generics: [
+                            {
+                                name: "u8",
+                                fullPath: ["u8"],
+                                pathWithoutLast: [],
+                                pathLast: "u8",
+                                generics: [],
+                                typeFilter: -1,
+                            },
+                        ],
+                        typeFilter: 1,
+                    },
+                    {
+                        name: "u8",
+                        fullPath: ["u8"],
+                        pathWithoutLast: [],
+                        pathLast: "u8",
+                        generics: [],
+                        typeFilter: -1,
+                    },
+                ],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "u8<&u8, u8>",
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'u8<&u8>',
+        elems: [
+            {
+                name: "u8",
+                fullPath: ["u8"],
+                pathWithoutLast: [],
+                pathLast: "u8",
+                generics: [
+                    {
+                        name: "reference",
+                        fullPath: ["reference"],
+                        pathWithoutLast: [],
+                        pathLast: "reference",
+                        generics: [
+                            {
+                                name: "u8",
+                                fullPath: ["u8"],
+                                pathWithoutLast: [],
+                                pathLast: "u8",
+                                generics: [],
+                                typeFilter: -1,
+                            },
+                        ],
+                        typeFilter: 1,
+                    },
+                ],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "u8<&u8>",
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'u8<&mut u8, u8>',
+        elems: [
+            {
+                name: "u8",
+                fullPath: ["u8"],
+                pathWithoutLast: [],
+                pathLast: "u8",
+                generics: [
+                    {
+                        name: "reference",
+                        fullPath: ["reference"],
+                        pathWithoutLast: [],
+                        pathLast: "reference",
+                        generics: [
+                            {
+                                name: "mut",
+                                fullPath: ["mut"],
+                                pathWithoutLast: [],
+                                pathLast: "mut",
+                                generics: [],
+                                typeFilter: 0,
+                            },
+                            {
+                                name: "u8",
+                                fullPath: ["u8"],
+                                pathWithoutLast: [],
+                                pathLast: "u8",
+                                generics: [],
+                                typeFilter: -1,
+                            },
+                        ],
+                        typeFilter: 1,
+                    },
+                    {
+                        name: "u8",
+                        fullPath: ["u8"],
+                        pathWithoutLast: [],
+                        pathLast: "u8",
+                        generics: [],
+                        typeFilter: -1,
+                    },
+                ],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "u8<&mut u8, u8>",
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'primitive:&u8',
+        elems: [
+            {
+                name: "reference",
+                fullPath: ["reference"],
+                pathWithoutLast: [],
+                pathLast: "reference",
+                generics: [
+                    {
+                        name: "u8",
+                        fullPath: ["u8"],
+                        pathWithoutLast: [],
+                        pathLast: "u8",
+                        generics: [],
+                        typeFilter: -1,
+                    },
+                ],
+                typeFilter: 1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "primitive:&u8",
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'macro:&u8',
+        elems: [],
+        foundElems: 0,
+        userQuery: "macro:&u8",
+        returned: [],
+        error: "Invalid search type: primitive `&` and `macro` both specified",
+    },
+    {
+        query: '&macro:u8',
+        elems: [
+            {
+                name: "reference",
+                fullPath: ["reference"],
+                pathWithoutLast: [],
+                pathLast: "reference",
+                generics: [
+                    {
+                        name: "u8",
+                        fullPath: ["u8"],
+                        pathWithoutLast: [],
+                        pathLast: "u8",
+                        generics: [],
+                        typeFilter: 16,
+                    },
+                ],
+                typeFilter: 1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "&macro:u8",
+        returned: [],
+        error: null,
+    },
+];
diff --git a/tests/rustdoc-js-std/parser-returned.js b/tests/rustdoc-js-std/parser-returned.js
new file mode 100644
index 00000000000..30ce26a8920
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-returned.js
@@ -0,0 +1,156 @@
+const PARSED = [
+    {
+        query: "-> F<P>",
+        elems: [],
+        foundElems: 1,
+        userQuery: "-> F<P>",
+        returned: [{
+            name: "F",
+            fullPath: ["f"],
+            pathWithoutLast: [],
+            pathLast: "f",
+            generics: [
+                {
+                    name: "P",
+                    fullPath: ["p"],
+                    pathWithoutLast: [],
+                    pathLast: "p",
+                    generics: [],
+                },
+            ],
+            typeFilter: -1,
+        }],
+        error: null,
+    },
+    {
+        query: "-> P",
+        elems: [],
+        foundElems: 1,
+        userQuery: "-> P",
+        returned: [{
+            name: "P",
+            fullPath: ["p"],
+            pathWithoutLast: [],
+            pathLast: "p",
+            generics: [],
+            typeFilter: -1,
+        }],
+        error: null,
+    },
+    {
+        query: "->,a",
+        elems: [],
+        foundElems: 1,
+        userQuery: "->,a",
+        returned: [{
+            name: "a",
+            fullPath: ["a"],
+            pathWithoutLast: [],
+            pathLast: "a",
+            generics: [],
+            typeFilter: -1,
+        }],
+        error: null,
+    },
+    {
+        query: "aaaaa->a",
+        elems: [{
+            name: "aaaaa",
+            fullPath: ["aaaaa"],
+            pathWithoutLast: [],
+            pathLast: "aaaaa",
+            generics: [],
+            typeFilter: -1,
+        }],
+        foundElems: 2,
+        userQuery: "aaaaa->a",
+        returned: [{
+            name: "a",
+            fullPath: ["a"],
+            pathWithoutLast: [],
+            pathLast: "a",
+            generics: [],
+            typeFilter: -1,
+        }],
+        error: null,
+    },
+    {
+        query: "-> !",
+        elems: [],
+        foundElems: 1,
+        userQuery: "-> !",
+        returned: [{
+            name: "never",
+            fullPath: ["never"],
+            pathWithoutLast: [],
+            pathLast: "never",
+            generics: [],
+            typeFilter: 1,
+        }],
+        error: null,
+    },
+    {
+        query: "a->",
+        elems: [{
+            name: "a",
+            fullPath: ["a"],
+            pathWithoutLast: [],
+            pathLast: "a",
+            generics: [],
+            typeFilter: -1,
+        }],
+        foundElems: 1,
+        userQuery: "a->",
+        returned: [],
+        hasReturnArrow: true,
+        error: null,
+    },
+    {
+        query: "!->",
+        elems: [{
+            name: "never",
+            fullPath: ["never"],
+            pathWithoutLast: [],
+            pathLast: "never",
+            generics: [],
+            typeFilter: 1,
+        }],
+        foundElems: 1,
+        userQuery: "!->",
+        returned: [],
+        hasReturnArrow: true,
+        error: null,
+    },
+    {
+        query: "! ->",
+        elems: [{
+            name: "never",
+            fullPath: ["never"],
+            pathWithoutLast: [],
+            pathLast: "never",
+            generics: [],
+            typeFilter: 1,
+        }],
+        foundElems: 1,
+        userQuery: "! ->",
+        returned: [],
+        hasReturnArrow: true,
+        error: null,
+    },
+    {
+        query: "primitive:!->",
+        elems: [{
+            name: "never",
+            fullPath: ["never"],
+            pathWithoutLast: [],
+            pathLast: "never",
+            generics: [],
+            typeFilter: 1,
+        }],
+        foundElems: 1,
+        userQuery: "primitive:!->",
+        returned: [],
+        hasReturnArrow: true,
+        error: null,
+    },
+];
diff --git a/tests/rustdoc-js-std/parser-separators.js b/tests/rustdoc-js-std/parser-separators.js
new file mode 100644
index 00000000000..cf271c80cdc
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-separators.js
@@ -0,0 +1,187 @@
+// ignore-tidy-tab
+
+const PARSED = [
+    {
+        query: 'aaaaaa	b',
+        elems: [
+            {
+                name: 'aaaaaa b',
+                fullPath: ['aaaaaa', 'b'],
+                pathWithoutLast: ['aaaaaa'],
+                pathLast: 'b',
+                generics: [],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "aaaaaa b",
+        returned: [],
+        error: null,
+    },
+    {
+        query: "aaaaaa,	b",
+        elems: [
+            {
+                name: 'aaaaaa',
+                fullPath: ['aaaaaa'],
+                pathWithoutLast: [],
+                pathLast: 'aaaaaa',
+                generics: [],
+                typeFilter: -1,
+            },
+            {
+                name: 'b',
+                fullPath: ['b'],
+                pathWithoutLast: [],
+                pathLast: 'b',
+                generics: [],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 2,
+        userQuery: "aaaaaa, b",
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'a b',
+        elems: [
+            {
+                name: 'a b',
+                fullPath: ['a', 'b'],
+                pathWithoutLast: ['a'],
+                pathLast: 'b',
+                generics: [],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "a b",
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'a,b',
+        elems: [
+            {
+                name: 'a',
+                fullPath: ['a'],
+                pathWithoutLast: [],
+                pathLast: 'a',
+                generics: [],
+                typeFilter: -1,
+            },
+            {
+                name: 'b',
+                fullPath: ['b'],
+                pathWithoutLast: [],
+                pathLast: 'b',
+                generics: [],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 2,
+        userQuery: "a,b",
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'a\tb',
+        elems: [
+            {
+                name: 'a b',
+                fullPath: ['a', 'b'],
+                pathWithoutLast: ['a'],
+                pathLast: 'b',
+                generics: [],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "a b",
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'a<b c>',
+        elems: [
+            {
+                name: 'a',
+                fullPath: ['a'],
+                pathWithoutLast: [],
+                pathLast: 'a',
+                generics: [
+                    {
+                        name: 'b c',
+                        fullPath: ['b', 'c'],
+                        pathWithoutLast: ['b'],
+                        pathLast: 'c',
+                        generics: [],
+                    },
+                ],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "a<b c>",
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'a<b,c>',
+        elems: [
+            {
+                name: 'a',
+                fullPath: ['a'],
+                pathWithoutLast: [],
+                pathLast: 'a',
+                generics: [
+                    {
+                        name: 'b',
+                        fullPath: ['b'],
+                        pathWithoutLast: [],
+                        pathLast: 'b',
+                        generics: [],
+                    },
+                    {
+                        name: 'c',
+                        fullPath: ['c'],
+                        pathWithoutLast: [],
+                        pathLast: 'c',
+                        generics: [],
+                    },
+                ],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "a<b,c>",
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'a<b\tc>',
+        elems: [
+            {
+                name: 'a',
+                fullPath: ['a'],
+                pathWithoutLast: [],
+                pathLast: 'a',
+                generics: [
+                    {
+                        name: 'b c',
+                        fullPath: ['b', 'c'],
+                        pathWithoutLast: ['b'],
+                        pathLast: 'c',
+                        generics: [],
+                    },
+                ],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "a<b c>",
+        returned: [],
+        error: null,
+    },
+];
diff --git a/tests/rustdoc-js-std/parser-slice-array.js b/tests/rustdoc-js-std/parser-slice-array.js
new file mode 100644
index 00000000000..65797945535
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-slice-array.js
@@ -0,0 +1,305 @@
+const PARSED = [
+    {
+        query: '[[[D, []]]',
+        elems: [],
+        foundElems: 0,
+        userQuery: '[[[D, []]]',
+        returned: [],
+        error: 'Unclosed `[`',
+    },
+    {
+        query: '[[[D, []]]]',
+        elems: [
+            {
+                name: "[]",
+                fullPath: ["[]"],
+                pathWithoutLast: [],
+                pathLast: "[]",
+                generics: [
+                    {
+                        name: "[]",
+                        fullPath: ["[]"],
+                        pathWithoutLast: [],
+                        pathLast: "[]",
+                        generics: [
+                            {
+                                name: "[]",
+                                fullPath: ["[]"],
+                                pathWithoutLast: [],
+                                pathLast: "[]",
+                                generics: [
+                                    {
+                                        name: "D",
+                                        fullPath: ["d"],
+                                        pathWithoutLast: [],
+                                        pathLast: "d",
+                                        generics: [],
+                                        typeFilter: -1,
+                                    },
+                                    {
+                                        name: "[]",
+                                        fullPath: ["[]"],
+                                        pathWithoutLast: [],
+                                        pathLast: "[]",
+                                        generics: [],
+                                        typeFilter: 1,
+                                    },
+                                ],
+                                typeFilter: 1,
+                            },
+                        ],
+                        typeFilter: 1,
+                    },
+                ],
+                typeFilter: 1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: '[[[D, []]]]',
+        returned: [],
+        error: null,
+    },
+    {
+        query: '[],u8',
+        elems: [
+            {
+                name: "[]",
+                fullPath: ["[]"],
+                pathWithoutLast: [],
+                pathLast: "[]",
+                generics: [],
+                typeFilter: 1,
+            },
+            {
+                name: "u8",
+                fullPath: ["u8"],
+                pathWithoutLast: [],
+                pathLast: "u8",
+                generics: [],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 2,
+        userQuery: "[],u8",
+        returned: [],
+        error: null,
+    },
+    {
+        query: '[u8]',
+        elems: [
+            {
+                name: "[]",
+                fullPath: ["[]"],
+                pathWithoutLast: [],
+                pathLast: "[]",
+                generics: [
+                    {
+                        name: "u8",
+                        fullPath: ["u8"],
+                        pathWithoutLast: [],
+                        pathLast: "u8",
+                        generics: [],
+                        typeFilter: -1,
+                    },
+                ],
+                typeFilter: 1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "[u8]",
+        returned: [],
+        error: null,
+    },
+    {
+        query: '[u8,u8]',
+        elems: [
+            {
+                name: "[]",
+                fullPath: ["[]"],
+                pathWithoutLast: [],
+                pathLast: "[]",
+                generics: [
+                    {
+                        name: "u8",
+                        fullPath: ["u8"],
+                        pathWithoutLast: [],
+                        pathLast: "u8",
+                        generics: [],
+                        typeFilter: -1,
+                    },
+                    {
+                        name: "u8",
+                        fullPath: ["u8"],
+                        pathWithoutLast: [],
+                        pathLast: "u8",
+                        generics: [],
+                        typeFilter: -1,
+                    },
+                ],
+                typeFilter: 1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "[u8,u8]",
+        returned: [],
+        error: null,
+    },
+    {
+        query: '[u8<u8>]',
+        elems: [
+            {
+                name: "[]",
+                fullPath: ["[]"],
+                pathWithoutLast: [],
+                pathLast: "[]",
+                generics: [
+                    {
+                        name: "u8",
+                        fullPath: ["u8"],
+                        pathWithoutLast: [],
+                        pathLast: "u8",
+                        generics: [
+                            {
+                                name: "u8",
+                                fullPath: ["u8"],
+                                pathWithoutLast: [],
+                                pathLast: "u8",
+                                generics: [],
+                                typeFilter: -1,
+                            },
+                        ],
+                        typeFilter: -1,
+                    },
+                ],
+                typeFilter: 1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "[u8<u8>]",
+        returned: [],
+        error: null,
+    },
+    {
+        query: '[]',
+        elems: [
+            {
+                name: "[]",
+                fullPath: ["[]"],
+                pathWithoutLast: [],
+                pathLast: "[]",
+                generics: [],
+                typeFilter: 1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "[]",
+        returned: [],
+        error: null,
+    },
+    {
+        query: '[>',
+        elems: [],
+        foundElems: 0,
+        userQuery: "[>",
+        returned: [],
+        error: "Unexpected `>` after `[`",
+    },
+    {
+        query: '[<',
+        elems: [],
+        foundElems: 0,
+        userQuery: "[<",
+        returned: [],
+        error: "Found generics without a path",
+    },
+    {
+        query: '[a>',
+        elems: [],
+        foundElems: 0,
+        userQuery: "[a>",
+        returned: [],
+        error: "Unexpected `>` after `[`",
+    },
+    {
+        query: '[a<',
+        elems: [],
+        foundElems: 0,
+        userQuery: "[a<",
+        returned: [],
+        error: "Unclosed `<`",
+    },
+    {
+        query: '[a',
+        elems: [],
+        foundElems: 0,
+        userQuery: "[a",
+        returned: [],
+        error: "Unclosed `[`",
+    },
+    {
+        query: '[',
+        elems: [],
+        foundElems: 0,
+        userQuery: "[",
+        returned: [],
+        error: "Unclosed `[`",
+    },
+    {
+        query: ']',
+        elems: [],
+        foundElems: 0,
+        userQuery: "]",
+        returned: [],
+        error: "Unexpected `]`",
+    },
+    {
+        query: '[a<b>',
+        elems: [],
+        foundElems: 0,
+        userQuery: "[a<b>",
+        returned: [],
+        error: "Unclosed `[`",
+    },
+    {
+        query: 'a<b>]',
+        elems: [],
+        foundElems: 0,
+        userQuery: "a<b>]",
+        returned: [],
+        error: "Unexpected `]` after `>`",
+    },
+    {
+        query: 'primitive:[u8]',
+        elems: [
+            {
+                name: "[]",
+                fullPath: ["[]"],
+                pathWithoutLast: [],
+                pathLast: "[]",
+                generics: [
+                    {
+                        name: "u8",
+                        fullPath: ["u8"],
+                        pathWithoutLast: [],
+                        pathLast: "u8",
+                        generics: [],
+                        typeFilter: -1,
+                    },
+                ],
+                typeFilter: 1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "primitive:[u8]",
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'macro:[u8]',
+        elems: [],
+        foundElems: 0,
+        userQuery: "macro:[u8]",
+        returned: [],
+        error: "Invalid search type: primitive `[]` and `macro` both specified",
+    },
+];
diff --git a/tests/rustdoc-js-std/parser-tuple.js b/tests/rustdoc-js-std/parser-tuple.js
new file mode 100644
index 00000000000..61925068387
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-tuple.js
@@ -0,0 +1,344 @@
+const PARSED = [
+    {
+        query: '(((D, ()))',
+        elems: [],
+        foundElems: 0,
+        userQuery: '(((D, ()))',
+        returned: [],
+        error: 'Unclosed `(`',
+    },
+    {
+        query: '(((D, ())))',
+        elems: [
+            {
+                name: "()",
+                fullPath: ["()"],
+                pathWithoutLast: [],
+                pathLast: "()",
+                generics: [
+                    {
+                        name: "D",
+                        fullPath: ["d"],
+                        pathWithoutLast: [],
+                        pathLast: "d",
+                        generics: [],
+                        typeFilter: -1,
+                    },
+                    {
+                        name: "()",
+                        fullPath: ["()"],
+                        pathWithoutLast: [],
+                        pathLast: "()",
+                        generics: [],
+                        typeFilter: 1,
+                    },
+                ],
+                typeFilter: 1,
+            }
+        ],
+        foundElems: 1,
+        userQuery: '(((D, ())))',
+        returned: [],
+        error: null,
+    },
+    {
+        query: '(),u8',
+        elems: [
+            {
+                name: "()",
+                fullPath: ["()"],
+                pathWithoutLast: [],
+                pathLast: "()",
+                generics: [],
+                typeFilter: 1,
+            },
+            {
+                name: "u8",
+                fullPath: ["u8"],
+                pathWithoutLast: [],
+                pathLast: "u8",
+                generics: [],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 2,
+        userQuery: "(),u8",
+        returned: [],
+        error: null,
+    },
+    // Parens act as grouping operators when:
+    // - there's no commas directly nested within
+    // - there's at least two child types (zero means unit)
+    // - it's not tagged with a type filter
+    // Otherwise, they represent unit and/or tuple. To search for
+    // unit or tuple specifically, use `primitive:unit` or `primitive:tuple<...>`.
+    {
+        query: '(u8)',
+        elems: [
+            {
+                name: "u8",
+                fullPath: ["u8"],
+                pathWithoutLast: [],
+                pathLast: "u8",
+                generics: [],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "(u8)",
+        returned: [],
+        error: null,
+    },
+    {
+        query: '(u8,)',
+        elems: [
+            {
+                name: "()",
+                fullPath: ["()"],
+                pathWithoutLast: [],
+                pathLast: "()",
+                generics: [
+                    {
+                        name: "u8",
+                        fullPath: ["u8"],
+                        pathWithoutLast: [],
+                        pathLast: "u8",
+                        generics: [],
+                        typeFilter: -1,
+                    },
+                ],
+                typeFilter: 1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "(u8,)",
+        returned: [],
+        error: null,
+    },
+    {
+        query: '(,u8)',
+        elems: [
+            {
+                name: "()",
+                fullPath: ["()"],
+                pathWithoutLast: [],
+                pathLast: "()",
+                generics: [
+                    {
+                        name: "u8",
+                        fullPath: ["u8"],
+                        pathWithoutLast: [],
+                        pathLast: "u8",
+                        generics: [],
+                        typeFilter: -1,
+                    },
+                ],
+                typeFilter: 1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "(,u8)",
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'primitive:(u8)',
+        elems: [
+            {
+                name: "()",
+                fullPath: ["()"],
+                pathWithoutLast: [],
+                pathLast: "()",
+                generics: [
+                    {
+                        name: "u8",
+                        fullPath: ["u8"],
+                        pathWithoutLast: [],
+                        pathLast: "u8",
+                        generics: [],
+                        typeFilter: -1,
+                    },
+                ],
+                typeFilter: 1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "primitive:(u8)",
+        returned: [],
+        error: null,
+    },
+    {
+        query: '(primitive:u8)',
+        elems: [
+            {
+                name: "u8",
+                fullPath: ["u8"],
+                pathWithoutLast: [],
+                pathLast: "u8",
+                generics: [],
+                typeFilter: 1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "(primitive:u8)",
+        returned: [],
+        error: null,
+    },
+    {
+        query: '(u8,u8)',
+        elems: [
+            {
+                name: "()",
+                fullPath: ["()"],
+                pathWithoutLast: [],
+                pathLast: "()",
+                generics: [
+                    {
+                        name: "u8",
+                        fullPath: ["u8"],
+                        pathWithoutLast: [],
+                        pathLast: "u8",
+                        generics: [],
+                        typeFilter: -1,
+                    },
+                    {
+                        name: "u8",
+                        fullPath: ["u8"],
+                        pathWithoutLast: [],
+                        pathLast: "u8",
+                        generics: [],
+                        typeFilter: -1,
+                    },
+                ],
+                typeFilter: 1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "(u8,u8)",
+        returned: [],
+        error: null,
+    },
+    {
+        query: '(u8<u8>)',
+        elems: [
+            {
+                name: "u8",
+                fullPath: ["u8"],
+                pathWithoutLast: [],
+                pathLast: "u8",
+                generics: [
+                    {
+                        name: "u8",
+                        fullPath: ["u8"],
+                        pathWithoutLast: [],
+                        pathLast: "u8",
+                        generics: [],
+                        typeFilter: -1,
+                    },
+                ],
+                typeFilter: -1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "(u8<u8>)",
+        returned: [],
+        error: null,
+    },
+    {
+        query: '()',
+        elems: [
+            {
+                name: "()",
+                fullPath: ["()"],
+                pathWithoutLast: [],
+                pathLast: "()",
+                generics: [],
+                typeFilter: 1,
+            },
+        ],
+        foundElems: 1,
+        userQuery: "()",
+        returned: [],
+        error: null,
+    },
+    {
+        query: '(>',
+        elems: [],
+        foundElems: 0,
+        userQuery: "(>",
+        returned: [],
+        error: "Unexpected `>` after `(`",
+    },
+    {
+        query: '(<',
+        elems: [],
+        foundElems: 0,
+        userQuery: "(<",
+        returned: [],
+        error: "Found generics without a path",
+    },
+    {
+        query: '(a>',
+        elems: [],
+        foundElems: 0,
+        userQuery: "(a>",
+        returned: [],
+        error: "Unexpected `>` after `(`",
+    },
+    {
+        query: '(a<',
+        elems: [],
+        foundElems: 0,
+        userQuery: "(a<",
+        returned: [],
+        error: "Unclosed `<`",
+    },
+    {
+        query: '(a',
+        elems: [],
+        foundElems: 0,
+        userQuery: "(a",
+        returned: [],
+        error: "Unclosed `(`",
+    },
+    {
+        query: '(',
+        elems: [],
+        foundElems: 0,
+        userQuery: "(",
+        returned: [],
+        error: "Unclosed `(`",
+    },
+    {
+        query: ')',
+        elems: [],
+        foundElems: 0,
+        userQuery: ")",
+        returned: [],
+        error: "Unexpected `)`",
+    },
+    {
+        query: '(a<b>',
+        elems: [],
+        foundElems: 0,
+        userQuery: "(a<b>",
+        returned: [],
+        error: "Unclosed `(`",
+    },
+    {
+        query: 'a<b>)',
+        elems: [],
+        foundElems: 0,
+        userQuery: "a<b>)",
+        returned: [],
+        error: "Unexpected `)` after `>`",
+    },
+    {
+        query: 'macro:(u8)',
+        elems: [],
+        foundElems: 0,
+        userQuery: "macro:(u8)",
+        returned: [],
+        error: "Invalid search type: primitive `()` and `macro` both specified",
+    },
+];
diff --git a/tests/rustdoc-js-std/parser-weird-queries.js b/tests/rustdoc-js-std/parser-weird-queries.js
new file mode 100644
index 00000000000..828b0a7d9f6
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-weird-queries.js
@@ -0,0 +1,85 @@
+// This test is mostly to check that the parser still kinda outputs something
+// (and doesn't enter an infinite loop!) even though the query is completely
+// invalid.
+
+const PARSED = [
+    {
+        query: 'a b',
+        elems: [
+            {
+                name: "a b",
+                fullPath: ["a", "b"],
+                pathWithoutLast: ["a"],
+                pathLast: "b",
+                generics: [],
+            },
+        ],
+        foundElems: 1,
+        userQuery: "a b",
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'a   b',
+        elems: [
+            {
+                name: "a   b",
+                fullPath: ["a", "b"],
+                pathWithoutLast: ["a"],
+                pathLast: "b",
+                generics: [],
+            },
+        ],
+        foundElems: 1,
+        userQuery: "a   b",
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'aaa,a',
+        elems: [
+            {
+                name: "aaa",
+                fullPath: ["aaa"],
+                pathWithoutLast: [],
+                pathLast: "aaa",
+                generics: [],
+            },
+            {
+                name: "a",
+                fullPath: ["a"],
+                pathWithoutLast: [],
+                pathLast: "a",
+                generics: [],
+            },
+        ],
+        foundElems: 2,
+        userQuery: "aaa,a",
+        returned: [],
+        error: null,
+    },
+    {
+        query: ',,,,',
+        elems: [],
+        foundElems: 0,
+        userQuery: ",,,,",
+        returned: [],
+        error: null,
+    },
+    {
+        query: 'mod    :',
+        elems: [],
+        foundElems: 0,
+        userQuery: 'mod    :',
+        returned: [],
+        error: "Unexpected `:` (expected path after type filter `mod:`)",
+    },
+    {
+        query: 'mod\t:',
+        elems: [],
+        foundElems: 0,
+        userQuery: 'mod :',
+        returned: [],
+        error: "Unexpected `:` (expected path after type filter `mod:`)",
+    },
+];
diff --git a/tests/rustdoc-js-std/path-end-empty.js b/tests/rustdoc-js-std/path-end-empty.js
new file mode 100644
index 00000000000..6e853c61b4d
--- /dev/null
+++ b/tests/rustdoc-js-std/path-end-empty.js
@@ -0,0 +1,6 @@
+const EXPECTED = {
+    'query': 'Option::',
+    'others': [
+        { 'path': 'std::option::Option', 'name': 'get_or_insert_default' },
+    ],
+}
diff --git a/tests/rustdoc-js-std/path-maxeditdistance.js b/tests/rustdoc-js-std/path-maxeditdistance.js
new file mode 100644
index 00000000000..6989e7d6488
--- /dev/null
+++ b/tests/rustdoc-js-std/path-maxeditdistance.js
@@ -0,0 +1,34 @@
+// exact-check
+const FILTER_CRATE = "std";
+const EXPECTED = [
+    {
+        query: 'vec::intoiterator',
+        // trait std::iter::IntoIterator is not the first result
+        others: [],
+    },
+    {
+        query: 'vec::iter',
+        others: [
+            // std::net::ToSocketAttrs::iter should not show up here
+            { 'path': 'std::vec', 'name': 'IntoIter' },
+            { 'path': 'std::vec::Vec', 'name': 'from_iter' },
+            { 'path': 'std::vec::Vec', 'name': 'into_iter' },
+            { 'path': 'std::vec::ExtractIf', 'name': 'into_iter' },
+            { 'path': 'std::vec::Drain', 'name': 'into_iter' },
+            { 'path': 'std::vec::IntoIter', 'name': 'into_iter' },
+            { 'path': 'std::vec::Splice', 'name': 'into_iter' },
+            { 'path': 'std::collections::VecDeque', 'name': 'iter' },
+            { 'path': 'std::collections::VecDeque', 'name': 'iter_mut' },
+            { 'path': 'std::collections::VecDeque', 'name': 'from_iter' },
+            { 'path': 'std::collections::VecDeque', 'name': 'into_iter' },
+        ],
+    },
+    {
+        query: 'slice::itermut',
+        others: [
+            // std::collections::btree_map::itermut should not show up here
+            { 'path': 'std::slice', 'name': 'IterMut' },
+            { 'path': 'std::slice', 'name': 'iter_mut' },
+        ],
+    },
+];
diff --git a/tests/rustdoc-js-std/path-ordering.js b/tests/rustdoc-js-std/path-ordering.js
new file mode 100644
index 00000000000..4bec4827d51
--- /dev/null
+++ b/tests/rustdoc-js-std/path-ordering.js
@@ -0,0 +1,19 @@
+const EXPECTED = [
+    {
+        query: 'hashset::insert',
+        others: [
+            // ensure hashset::insert comes first
+            { 'path': 'std::collections::HashSet', 'name': 'insert' },
+            { 'path': 'std::collections::HashSet', 'name': 'get_or_insert' },
+            { 'path': 'std::collections::HashSet', 'name': 'get_or_insert_with' },
+        ],
+    },
+    {
+        query: 'hash::insert',
+        others: [
+            // ensure hashset/hashmap::insert come first
+            { 'path': 'std::collections::HashMap', 'name': 'insert' },
+            { 'path': 'std::collections::HashSet', 'name': 'insert' },
+        ],
+    },
+];
diff --git a/tests/rustdoc-js-std/primitive.js b/tests/rustdoc-js-std/primitive.js
new file mode 100644
index 00000000000..737e429bf55
--- /dev/null
+++ b/tests/rustdoc-js-std/primitive.js
@@ -0,0 +1,72 @@
+const EXPECTED = [
+    {
+        'query': 'i8',
+        'others': [
+            {
+                'path': 'std',
+                'name': 'i8',
+                'href': '../std/primitive.i8.html',
+            },
+        ]
+    },
+    {
+        'query': 'u32',
+        'others': [
+            {
+                'path': 'std',
+                'name': 'u32',
+                'href': '../std/primitive.u32.html',
+            },
+        ]
+    },
+    {
+        'query': 'str',
+        'others': [
+            {
+                'path': 'std',
+                'name': 'str',
+                'href': '../std/primitive.str.html',
+            },
+        ]
+    },
+    {
+        'query': 'char',
+        'others': [
+            {
+                'path': 'std',
+                'name': 'char',
+                'href': '../std/primitive.char.html',
+            },
+        ]
+    },
+    {
+        'query': 'unit',
+        'others': [
+            {
+                'path': 'std',
+                'name': 'unit',
+                'href': '../std/primitive.unit.html',
+            },
+        ]
+    },
+    {
+        'query': 'tuple',
+        'others': [
+            {
+                'path': 'std',
+                'name': 'tuple',
+                'href': '../std/primitive.tuple.html',
+            },
+        ]
+    },
+    {
+        'query': 'fn',
+        'others': [
+            {
+                'path': 'std',
+                'name': 'fn',
+                'href': '../std/primitive.fn.html',
+            },
+        ]
+    },
+];
diff --git a/tests/rustdoc-js-std/println-typo.js b/tests/rustdoc-js-std/println-typo.js
new file mode 100644
index 00000000000..a4dd90a44d5
--- /dev/null
+++ b/tests/rustdoc-js-std/println-typo.js
@@ -0,0 +1,12 @@
+// exact-check
+
+const FILTER_CRATE = 'std';
+
+const EXPECTED = {
+    'query': 'prinltn',
+    'others': [
+        { 'path': 'std', 'name': 'println' },
+        { 'path': 'std', 'name': 'print' },
+        { 'path': 'std', 'name': 'eprintln' },
+    ],
+};
diff --git a/tests/rustdoc-js-std/quoted.js b/tests/rustdoc-js-std/quoted.js
new file mode 100644
index 00000000000..8a927501925
--- /dev/null
+++ b/tests/rustdoc-js-std/quoted.js
@@ -0,0 +1,21 @@
+// ignore-order
+
+const FILTER_CRATE = 'std';
+
+const EXPECTED = {
+    'query': '"error"',
+    'others': [
+        { 'path': 'std', 'name': 'error' },
+        { 'path': 'std::fmt', 'name': 'Error' },
+        { 'path': 'std::io', 'name': 'Error' },
+    ],
+    'in_args': [
+        { 'path': 'std::fmt::Error', 'name': 'eq' },
+        { 'path': 'std::fmt::Error', 'name': 'cmp' },
+        { 'path': 'std::fmt::Error', 'name': 'partial_cmp' },
+
+    ],
+    'returned': [
+        { 'path': 'std::fmt::LowerExp', 'name': 'fmt' },
+    ],
+};
diff --git a/tests/rustdoc-js-std/reference-shrink.js b/tests/rustdoc-js-std/reference-shrink.js
new file mode 100644
index 00000000000..b602bbdca18
--- /dev/null
+++ b/tests/rustdoc-js-std/reference-shrink.js
@@ -0,0 +1,7 @@
+// exact-check
+
+const EXPECTED = {
+    'query': 'reference::shrink',
+    // avoid including the method that's not going to be in the HTML
+    'others': [],
+};
diff --git a/tests/rustdoc-js-std/regex.js b/tests/rustdoc-js-std/regex.js
new file mode 100644
index 00000000000..7dc38939a17
--- /dev/null
+++ b/tests/rustdoc-js-std/regex.js
@@ -0,0 +1,9 @@
+// exact-check
+
+// https://github.com/rust-lang/rust/issues/103357
+const EXPECTED = {
+    'query': 'regex',
+    'others': [],
+    'in_args': [],
+    'returned': [],
+};
diff --git a/tests/rustdoc-js-std/return-based-sort.js b/tests/rustdoc-js-std/return-based-sort.js
new file mode 100644
index 00000000000..30baf1cd36e
--- /dev/null
+++ b/tests/rustdoc-js-std/return-based-sort.js
@@ -0,0 +1,30 @@
+// test that `clone`-like functions are sorted lower when
+// a search is based soley on return type
+
+const FILTER_CRATE = "core";
+
+const EXPECTED = [
+    {
+        'query': '-> AllocError',
+        'others': [
+            { 'path': 'core::alloc::Allocator', 'name': 'allocate' },
+            { 'path': 'core::alloc::AllocError', 'name': 'clone' },
+        ],
+    },
+    {
+        'query': 'AllocError',
+        'returned': [
+            { 'path': 'core::alloc::Allocator', 'name': 'allocate' },
+            { 'path': 'core::alloc::AllocError', 'name': 'clone' },
+         ],
+    },
+    {
+        'query': '-> &str',
+        'others': [
+            // type_name_of_val should not be consider clone-like
+            { 'path': 'core::any', 'name': 'type_name_of_val' },
+            // this returns `Option<&str>`, and thus should be sorted lower
+            { 'path': 'core::str::Split', 'name': 'next' },
+         ],
+    },
+]
diff --git a/tests/rustdoc-js-std/return-specific-literal.js b/tests/rustdoc-js-std/return-specific-literal.js
new file mode 100644
index 00000000000..86ed3aceb4e
--- /dev/null
+++ b/tests/rustdoc-js-std/return-specific-literal.js
@@ -0,0 +1,9 @@
+const EXPECTED = {
+    'query': 'struct:"string"',
+    'in_args': [
+        { 'path': 'std::string::String', 'name': 'ne' },
+    ],
+    'returned': [
+        { 'path': 'std::string::String', 'name': 'add' },
+    ],
+};
diff --git a/tests/rustdoc-js-std/return-specific.js b/tests/rustdoc-js-std/return-specific.js
new file mode 100644
index 00000000000..be54a1c9772
--- /dev/null
+++ b/tests/rustdoc-js-std/return-specific.js
@@ -0,0 +1,9 @@
+const EXPECTED = {
+    'query': 'struct:string',
+    'in_args': [
+        { 'path': 'std::string::String', 'name': 'ne' },
+    ],
+    'returned': [
+        { 'path': 'std::string::String', 'name': 'add' },
+    ],
+};
diff --git a/tests/rustdoc-js-std/should-fail.js b/tests/rustdoc-js-std/should-fail.js
new file mode 100644
index 00000000000..94f82efd9b4
--- /dev/null
+++ b/tests/rustdoc-js-std/should-fail.js
@@ -0,0 +1,8 @@
+// should-fail
+
+const EXPECTED = {
+    'query': 'fn',
+    'others': [
+        { 'path': 'std', 'name': 'fn', ty: 14 },
+    ],
+};
diff --git a/tests/rustdoc-js-std/simd-type-signatures.js b/tests/rustdoc-js-std/simd-type-signatures.js
new file mode 100644
index 00000000000..fea34ff97f2
--- /dev/null
+++ b/tests/rustdoc-js-std/simd-type-signatures.js
@@ -0,0 +1,70 @@
+// exact-check
+// ignore-order
+// ignore-tidy-linelength
+
+// This test case verifies that the href points at the correct impl
+
+const FILTER_CRATE = "std";
+
+const EXPECTED = [
+    {
+        'query': 'simd<i16>, simd<i16> -> simd<i16>',
+        'others': [
+            {
+                'path': 'std::simd::Simd',
+                'name': 'simd_max',
+                'href': '../std/simd/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci16,+N%3E/method.simd_max'
+            },
+            {
+                'path': 'std::simd::Simd',
+                'name': 'simd_min',
+                'href': '../std/simd/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci16,+N%3E/method.simd_min'
+            },
+            {
+                'path': 'std::simd::Simd',
+                'name': 'saturating_add',
+                'href': '../std/simd/struct.Simd.html#impl-SimdInt-for-Simd%3Ci16,+N%3E/method.saturating_add'
+            },
+            {
+                'path': 'std::simd::Simd',
+                'name': 'saturating_sub',
+                'href': '../std/simd/struct.Simd.html#impl-SimdInt-for-Simd%3Ci16,+N%3E/method.saturating_sub'
+            },
+            {
+                'path': 'std::simd::Simd',
+                'name': 'simd_clamp',
+                'href': '../std/simd/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci16,+N%3E/method.simd_clamp'
+            },
+        ],
+    },
+    {
+        'query': 'simd<i8>, simd<i8> -> simd<i8>',
+        'others': [
+            {
+                'path': 'std::simd::Simd',
+                'name': 'simd_max',
+                'href': '../std/simd/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci8,+N%3E/method.simd_max'
+            },
+            {
+                'path': 'std::simd::Simd',
+                'name': 'simd_min',
+                'href': '../std/simd/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci8,+N%3E/method.simd_min'
+            },
+            {
+                'path': 'std::simd::Simd',
+                'name': 'saturating_add',
+                'href': '../std/simd/struct.Simd.html#impl-SimdInt-for-Simd%3Ci8,+N%3E/method.saturating_add'
+            },
+            {
+                'path': 'std::simd::Simd',
+                'name': 'saturating_sub',
+                'href': '../std/simd/struct.Simd.html#impl-SimdInt-for-Simd%3Ci8,+N%3E/method.saturating_sub'
+            },
+            {
+                'path': 'std::simd::Simd',
+                'name': 'simd_clamp',
+                'href': '../std/simd/struct.Simd.html#impl-SimdOrd-for-Simd%3Ci8,+N%3E/method.simd_clamp'
+            },
+        ],
+    },
+];
diff --git a/tests/rustdoc-js-std/string-from_ut.js b/tests/rustdoc-js-std/string-from_ut.js
new file mode 100644
index 00000000000..1fff6ee28bb
--- /dev/null
+++ b/tests/rustdoc-js-std/string-from_ut.js
@@ -0,0 +1,10 @@
+const EXPECTED = {
+    'query': 'String::from_ut',
+    'others': [
+        { 'path': 'std::string::String', 'name': 'from_utf8' },
+        { 'path': 'std::string::String', 'name': 'from_utf8' },
+        { 'path': 'std::string::String', 'name': 'from_utf8_lossy' },
+        { 'path': 'std::string::String', 'name': 'from_utf16_lossy' },
+        { 'path': 'std::string::String', 'name': 'from_utf8_unchecked' },
+    ],
+};
diff --git a/tests/rustdoc-js-std/struct-vec.js b/tests/rustdoc-js-std/struct-vec.js
new file mode 100644
index 00000000000..dd72aaa1ab8
--- /dev/null
+++ b/tests/rustdoc-js-std/struct-vec.js
@@ -0,0 +1,7 @@
+const EXPECTED = {
+    'query': 'struct:VecD',
+    'others': [
+        { 'path': 'std::collections', 'name': 'VecDeque' },
+        { 'path': 'std::vec', 'name': 'Vec' },
+    ],
+};
diff --git a/tests/rustdoc-js-std/transmute-fail.js b/tests/rustdoc-js-std/transmute-fail.js
new file mode 100644
index 00000000000..ddfb2761948
--- /dev/null
+++ b/tests/rustdoc-js-std/transmute-fail.js
@@ -0,0 +1,14 @@
+// should-fail
+const FILTER_CRATE = "std";
+const EXPECTED = [
+    {
+        // Keep this test case identical to `transmute`, except the
+        // should-fail tag and the search query below:
+        'query': 'generic:T -> generic:T',
+        'others': [
+            { 'path': 'std::intrinsics::simd', 'name': 'simd_as' },
+            { 'path': 'std::intrinsics::simd', 'name': 'simd_cast' },
+            { 'path': 'std::mem', 'name': 'transmute' },
+        ],
+    },
+];
diff --git a/tests/rustdoc-js-std/transmute.js b/tests/rustdoc-js-std/transmute.js
new file mode 100644
index 00000000000..f52e0ab1436
--- /dev/null
+++ b/tests/rustdoc-js-std/transmute.js
@@ -0,0 +1,13 @@
+const FILTER_CRATE = "std";
+const EXPECTED = [
+    {
+        // Keep this test case identical to `transmute-fail`, except the
+        // should-fail tag and the search query below:
+        'query': 'generic:T -> generic:U',
+        'others': [
+            { 'path': 'std::intrinsics::simd', 'name': 'simd_as' },
+            { 'path': 'std::intrinsics::simd', 'name': 'simd_cast' },
+            { 'path': 'std::mem', 'name': 'transmute' },
+        ],
+    },
+];
diff --git a/tests/rustdoc-js-std/typed-query.js b/tests/rustdoc-js-std/typed-query.js
new file mode 100644
index 00000000000..8e84645889a
--- /dev/null
+++ b/tests/rustdoc-js-std/typed-query.js
@@ -0,0 +1,13 @@
+// exact-check
+
+const FILTER_CRATE = 'std';
+
+const EXPECTED = {
+    'query': 'macro:print',
+    'others': [
+        { 'path': 'std', 'name': 'print' },
+        { 'path': 'std', 'name': 'println' },
+        { 'path': 'std', 'name': 'eprint' },
+        { 'path': 'std', 'name': 'eprintln' },
+    ],
+};
diff --git a/tests/rustdoc-js-std/unbox-type-result.js b/tests/rustdoc-js-std/unbox-type-result.js
new file mode 100644
index 00000000000..1f5cba58adf
--- /dev/null
+++ b/tests/rustdoc-js-std/unbox-type-result.js
@@ -0,0 +1,20 @@
+// exact-check
+
+// Test case for https://github.com/rust-lang/rust/issues/139665
+// make sure that std::io::Result and std::thread::Result get unboxed
+
+const EXPECTED = [
+    {
+        query: "File -> Metadata",
+        others: [
+            { path: "std::fs::File", name: "metadata" },
+            { path: "std::fs::File", name: "metadata_at" },
+        ]
+    },
+    {
+        query: "JoinHandle<T> -> T",
+        others: [
+            { path: "std::thread::JoinHandle", name: "join" },
+        ]
+    },
+];
diff --git a/tests/rustdoc-js-std/vec-new.js b/tests/rustdoc-js-std/vec-new.js
new file mode 100644
index 00000000000..0eae8b6c197
--- /dev/null
+++ b/tests/rustdoc-js-std/vec-new.js
@@ -0,0 +1,50 @@
+const EXPECTED = [
+    {
+        'query': 'Vec::new',
+        'others': [
+            { 'path': 'std::vec::Vec', 'name': 'new' },
+            { 'path': 'std::vec::Vec', 'name': 'new_in' },
+        ],
+    },
+    {
+        'query': 'prelude::vec',
+        'others': [
+            { 'path': 'std::prelude::v1', 'name': 'Vec' },
+        ],
+    },
+    {
+        'query': 'Vec new',
+        'others': [
+            { 'path': 'std::vec::Vec', 'name': 'new' },
+            { 'path': 'std::vec::Vec', 'name': 'new_in' },
+        ],
+    },
+    {
+        'query': 'std::Vec::new',
+        'others': [
+            { 'path': 'std::vec::Vec', 'name': 'new' },
+            { 'path': 'std::vec::Vec', 'name': 'new_in' },
+        ],
+    },
+    {
+        'query': 'std Vec new',
+        'others': [
+            { 'path': 'std::vec::Vec', 'name': 'new' },
+            { 'path': 'std::vec::Vec', 'name': 'new_in' },
+        ],
+    },
+    {
+        'query': 'alloc::Vec::new',
+        'others': [
+            { 'path': 'alloc::vec::Vec', 'name': 'new' },
+            { 'path': 'alloc::vec::Vec', 'name': 'new_in' },
+        ],
+    },
+    {
+        'query': 'alloc Vec new',
+        'others': [
+            { 'path': 'alloc::vec::Vec', 'name': 'new' },
+            { 'path': 'alloc::vec::Vec', 'name': 'new_in' },
+        ],
+    },
+];
diff --git a/tests/rustdoc-js-std/vec-type-signatures.js b/tests/rustdoc-js-std/vec-type-signatures.js
new file mode 100644
index 00000000000..3c2ff30a833
--- /dev/null
+++ b/tests/rustdoc-js-std/vec-type-signatures.js
@@ -0,0 +1,34 @@
+// ignore-order
+
+const FILTER_CRATE = "std";
+
+const EXPECTED = [
+    {
+        'query': 'vec::intoiter<T> -> [T]',
+        'others': [
+            { 'path': 'std::vec::IntoIter', 'name': 'as_slice' },
+            { 'path': 'std::vec::IntoIter', 'name': 'as_mut_slice' },
+            { 'path': 'std::vec::IntoIter', 'name': 'next_chunk' },
+        ],
+    },
+    {
+        'query': 'vec::intoiter<T> -> []',
+        'others': [
+            { 'path': 'std::vec::IntoIter', 'name': 'as_slice' },
+            { 'path': 'std::vec::IntoIter', 'name': 'as_mut_slice' },
+            { 'path': 'std::vec::IntoIter', 'name': 'next_chunk' },
+        ],
+    },
+    {
+        'query': 'vec<T, Allocator> -> Box<[T]>',
+        'others': [
+            {
+                'path': 'std::boxed::Box',
+                'name': 'from',
+                'displayType': '`Vec`<`T`, `A`> -> `Box`<`[T]`, A>',
+                'displayMappedNames': `T = T`,
+                'displayWhereClause': 'A: `Allocator`',
+            },
+        ],
+    },
+];
diff --git a/tests/rustdoc-js-std/write.js b/tests/rustdoc-js-std/write.js
new file mode 100644
index 00000000000..4a9475102a5
--- /dev/null
+++ b/tests/rustdoc-js-std/write.js
@@ -0,0 +1,24 @@
+const EXPECTED = [
+    {
+        'query': 'write',
+        'others': [
+            { 'path': 'std::fmt', 'name': 'write' },
+            { 'path': 'std::fs', 'name': 'write' },
+            { 'path': 'std::ptr', 'name': 'write' },
+            { 'path': 'std::fmt', 'name': 'Write' },
+            { 'path': 'std::io', 'name': 'Write' },
+            { 'path': 'std::hash::Hasher', 'name': 'write' },
+        ],
+    },
+    {
+        'query': 'Write',
+        'others': [
+            { 'path': 'std::fmt', 'name': 'Write' },
+            { 'path': 'std::io', 'name': 'Write' },
+            { 'path': 'std::fmt', 'name': 'write' },
+            { 'path': 'std::fs', 'name': 'write' },
+            { 'path': 'std::ptr', 'name': 'write' },
+            { 'path': 'std::hash::Hasher', 'name': 'write' },
+        ],
+    },
+];