about summary refs log tree commit diff
path: root/tests/rustdoc-js-std/parser-generics.js
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2023-03-30 21:53:11 -0700
committerMichael Howell <michael@notriddle.com>2023-04-14 14:55:45 -0700
commitafee2411e3fd5c6e8b3301fa748a760e01615904 (patch)
treeacfe106f4aa933d1a4a76f5e1b9104924cfcec25 /tests/rustdoc-js-std/parser-generics.js
parent276fa294809e914b1d04192392d256814aa5ce1a (diff)
downloadrust-afee2411e3fd5c6e8b3301fa748a760e01615904.tar.gz
rust-afee2411e3fd5c6e8b3301fa748a760e01615904.zip
rustdoc-search: add support for nested generics
Diffstat (limited to 'tests/rustdoc-js-std/parser-generics.js')
-rw-r--r--tests/rustdoc-js-std/parser-generics.js124
1 files changed, 122 insertions, 2 deletions
diff --git a/tests/rustdoc-js-std/parser-generics.js b/tests/rustdoc-js-std/parser-generics.js
index c448d845acb..5a2266dbe36 100644
--- a/tests/rustdoc-js-std/parser-generics.js
+++ b/tests/rustdoc-js-std/parser-generics.js
@@ -1,4 +1,11 @@
-const QUERY = ['A<B<C<D>,  E>', 'p<> u8', '"p"<a>'];
+const QUERY = [
+    'A<B<C<D>,  E>',
+    'p<> u8',
+    '"p"<a>',
+    'p<u<x>>',
+    'p<u<x>, r>',
+    'p<u<x, r>>',
+];
 
 const PARSED = [
     {
@@ -7,7 +14,7 @@ const PARSED = [
         original: 'A<B<C<D>,  E>',
         returned: [],
         userQuery: 'a<b<c<d>,  e>',
-        error: 'Unexpected `<` after `<`',
+        error: 'Unclosed `<`',
     },
     {
         elems: [
@@ -59,4 +66,117 @@ const PARSED = [
         userQuery: '"p"<a>',
         error: null,
     },
+    {
+        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,
+        original: 'p<u<x>>',
+        returned: [],
+        userQuery: 'p<u<x>>',
+        error: null,
+    },
+    {
+        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,
+        original: 'p<u<x>, r>',
+        returned: [],
+        userQuery: 'p<u<x>, r>',
+        error: null,
+    },
+    {
+        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,
+        original: 'p<u<x, r>>',
+        returned: [],
+        userQuery: 'p<u<x, r>>',
+        error: null,
+    },
 ];