about summary refs log tree commit diff
path: root/tests/rustdoc-js-std/parser-errors.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rustdoc-js-std/parser-errors.js')
-rw-r--r--tests/rustdoc-js-std/parser-errors.js174
1 files changed, 89 insertions, 85 deletions
diff --git a/tests/rustdoc-js-std/parser-errors.js b/tests/rustdoc-js-std/parser-errors.js
index dc42031e05f..af7f63f99cb 100644
--- a/tests/rustdoc-js-std/parser-errors.js
+++ b/tests/rustdoc-js-std/parser-errors.js
@@ -1,385 +1,389 @@
-const QUERY = [
-    '<P>',
-    '-> <P>',
-    'a<"P">',
-    '"P" "P"',
-    'P "P"',
-    '"p" p',
-    '"const": p',
-    "a<:a>",
-    "a<::a>",
-    "((a))",
-    "(p -> p",
-    "::a::b",
-    "a::::b",
-    "a::b::",
-    ":a",
-    "a b:",
-    "a (b:",
-    "_:",
-    "a-bb",
-    "a>bb",
-    "ab'",
-    "a->",
-    '"p" <a>',
-    '"p" a<a>',
-    "a,<",
-    "aaaaa<>b",
-    "fn:aaaaa<>b",
-    "->a<>b",
-    "a<->",
-    "a:: a",
-    "a ::a",
-    "a<a>:",
-    "a<>:",
-    "a,:",
-    "  a<>  :",
-    "mod : :",
-    "a!a",
-    "a!!",
-];
-
 const PARSED = [
     {
+        query: '<P>',
         elems: [],
         foundElems: 0,
         original: "<P>",
         returned: [],
-        typeFilter: -1,
         userQuery: "<p>",
         error: "Found generics without a path",
     },
     {
+        query: '-> <P>',
         elems: [],
         foundElems: 0,
         original: "-> <P>",
         returned: [],
-        typeFilter: -1,
         userQuery: "-> <p>",
         error: "Found generics without a path",
     },
     {
+        query: 'a<"P">',
         elems: [],
         foundElems: 0,
         original: "a<\"P\">",
         returned: [],
-        typeFilter: -1,
         userQuery: "a<\"p\">",
-        error: "`\"` cannot be used in generics",
+        error: "Unexpected `\"` in generics",
     },
     {
+        query: '"P" "P"',
         elems: [],
         foundElems: 0,
         original: "\"P\" \"P\"",
         returned: [],
-        typeFilter: -1,
         userQuery: "\"p\" \"p\"",
         error: "Cannot have more than one literal search element",
     },
     {
+        query: 'P "P"',
         elems: [],
         foundElems: 0,
         original: "P \"P\"",
         returned: [],
-        typeFilter: -1,
         userQuery: "p \"p\"",
         error: "Cannot use literal search when there is more than one element",
     },
     {
+        query: '"p" p',
         elems: [],
         foundElems: 0,
         original: "\"p\" p",
         returned: [],
-        typeFilter: -1,
         userQuery: "\"p\" p",
         error: "You cannot have more than one element if you use quotes",
     },
     {
+        query: '"const": p',
         elems: [],
         foundElems: 0,
         original: "\"const\": p",
         returned: [],
-        typeFilter: -1,
         userQuery: "\"const\": p",
         error: "You cannot use quotes on type filter",
     },
     {
+        query: "a<:a>",
         elems: [],
         foundElems: 0,
         original: "a<:a>",
         returned: [],
-        typeFilter: -1,
         userQuery: "a<:a>",
-        error: "Unexpected `:` after `<`",
+        error: "Expected type filter before `:`",
     },
     {
+        query: "a<::a>",
         elems: [],
         foundElems: 0,
         original: "a<::a>",
         returned: [],
-        typeFilter: -1,
         userQuery: "a<::a>",
         error: "Unexpected `::`: paths cannot start with `::`",
     },
     {
+        query: "((a))",
         elems: [],
         foundElems: 0,
         original: "((a))",
         returned: [],
-        typeFilter: -1,
         userQuery: "((a))",
         error: "Unexpected `(`",
     },
     {
+        query: "(p -> p",
         elems: [],
         foundElems: 0,
         original: "(p -> p",
         returned: [],
-        typeFilter: -1,
         userQuery: "(p -> p",
         error: "Unexpected `(`",
     },
     {
+        query: "::a::b",
         elems: [],
         foundElems: 0,
         original: "::a::b",
         returned: [],
-        typeFilter: -1,
         userQuery: "::a::b",
         error: "Paths cannot start with `::`",
     },
     {
+        query: "a::::b",
         elems: [],
         foundElems: 0,
         original: "a::::b",
         returned: [],
-        typeFilter: -1,
         userQuery: "a::::b",
         error: "Unexpected `::::`",
     },
     {
+        query: "a::b::",
         elems: [],
         foundElems: 0,
         original: "a::b::",
         returned: [],
-        typeFilter: -1,
         userQuery: "a::b::",
         error: "Paths cannot end with `::`",
     },
     {
+        query: ":a",
         elems: [],
         foundElems: 0,
         original: ":a",
         returned: [],
-        typeFilter: -1,
         userQuery: ":a",
         error: "Expected type filter before `:`",
     },
     {
+        query: "a b:",
         elems: [],
         foundElems: 0,
         original: "a b:",
         returned: [],
-        typeFilter: -1,
         userQuery: "a b:",
-        error: "Unexpected `:`",
+        error: "Unexpected `:` (expected path after type filter)",
     },
     {
+        query: "a (b:",
         elems: [],
         foundElems: 0,
         original: "a (b:",
         returned: [],
-        typeFilter: -1,
         userQuery: "a (b:",
         error: "Unexpected `(`",
     },
     {
+        query: "_:",
         elems: [],
         foundElems: 0,
         original: "_:",
         returned: [],
-        typeFilter: -1,
         userQuery: "_:",
+        error: "Unexpected `:` (expected path after type filter)",
+    },
+    {
+        query: "_:a",
+        elems: [],
+        foundElems: 0,
+        original: "_:a",
+        returned: [],
+        userQuery: "_:a",
         error: "Unknown type filter `_`",
     },
     {
+        query: "a-bb",
         elems: [],
         foundElems: 0,
         original: "a-bb",
         returned: [],
-        typeFilter: -1,
         userQuery: "a-bb",
         error: "Unexpected `-` (did you mean `->`?)",
     },
     {
+        query: "a>bb",
         elems: [],
         foundElems: 0,
         original: "a>bb",
         returned: [],
-        typeFilter: -1,
         userQuery: "a>bb",
         error: "Unexpected `>` (did you mean `->`?)",
     },
     {
+        query: "ab'",
         elems: [],
         foundElems: 0,
         original: "ab'",
         returned: [],
-        typeFilter: -1,
         userQuery: "ab'",
         error: "Unexpected `'`",
     },
     {
+        query: "a->",
         elems: [],
         foundElems: 0,
         original: "a->",
         returned: [],
-        typeFilter: -1,
         userQuery: "a->",
         error: "Expected at least one item after `->`",
     },
     {
+        query: '"p" <a>',
         elems: [],
         foundElems: 0,
         original: '"p" <a>',
         returned: [],
-        typeFilter: -1,
         userQuery: '"p" <a>',
         error: "Found generics without a path",
     },
     {
+        query: '"p" a<a>',
         elems: [],
         foundElems: 0,
         original: '"p" a<a>',
         returned: [],
-        typeFilter: -1,
         userQuery: '"p" a<a>',
         error: "You cannot have more than one element if you use quotes",
     },
     {
+        query: "a,<",
         elems: [],
         foundElems: 0,
         original: 'a,<',
         returned: [],
-        typeFilter: -1,
         userQuery: 'a,<',
         error: 'Found generics without a path',
     },
     {
+        query: "aaaaa<>b",
         elems: [],
         foundElems: 0,
         original: 'aaaaa<>b',
         returned: [],
-        typeFilter: -1,
         userQuery: 'aaaaa<>b',
         error: 'Expected `,`, ` `, `:` or `->`, found `b`',
     },
     {
+        query: "fn:aaaaa<>b",
         elems: [],
         foundElems: 0,
         original: 'fn:aaaaa<>b',
         returned: [],
-        typeFilter: -1,
         userQuery: 'fn:aaaaa<>b',
-        error: 'Expected `,`, ` ` or `->`, found `b`',
+        error: 'Expected `,`, ` `, `:` or `->`, found `b`',
     },
     {
+        query: "->a<>b",
         elems: [],
         foundElems: 0,
         original: '->a<>b',
         returned: [],
-        typeFilter: -1,
         userQuery: '->a<>b',
         error: 'Expected `,` or ` `, found `b`',
     },
     {
+        query: "a<->",
         elems: [],
         foundElems: 0,
         original: 'a<->',
         returned: [],
-        typeFilter: -1,
         userQuery: 'a<->',
         error: 'Unexpected `-` after `<`',
     },
     {
+        query: "a:: a",
         elems: [],
         foundElems: 0,
         original: 'a:: a',
         returned: [],
-        typeFilter: -1,
         userQuery: 'a:: a',
         error: 'Paths cannot end with `::`',
     },
     {
+        query: "a ::a",
         elems: [],
         foundElems: 0,
         original: 'a ::a',
         returned: [],
-        typeFilter: -1,
         userQuery: 'a ::a',
         error: 'Paths cannot start with `::`',
     },
     {
+        query: "a<a>:",
         elems: [],
         foundElems: 0,
         original: "a<a>:",
         returned: [],
-        typeFilter: -1,
         userQuery: "a<a>:",
-        error: 'Unexpected `:`',
+        error: 'Unexpected `<` in type filter',
     },
     {
+        query: "a<>:",
         elems: [],
         foundElems: 0,
         original: "a<>:",
         returned: [],
-        typeFilter: -1,
         userQuery: "a<>:",
         error: 'Unexpected `<` in type filter',
     },
     {
+        query: "a,:",
         elems: [],
         foundElems: 0,
         original: "a,:",
         returned: [],
-        typeFilter: -1,
         userQuery: "a,:",
         error: 'Unexpected `,` in type filter',
     },
     {
+        query: "  a<>  :",
         elems: [],
         foundElems: 0,
         original: "a<>  :",
         returned: [],
-        typeFilter: -1,
         userQuery: "a<>  :",
         error: 'Unexpected `<` in type filter',
     },
     {
+        query: "mod : :",
         elems: [],
         foundElems: 0,
         original: "mod : :",
         returned: [],
-        typeFilter: -1,
         userQuery: "mod : :",
         error: 'Unexpected `:`',
     },
     {
+        query: "a!a",
         elems: [],
         foundElems: 0,
         original: "a!a",
         returned: [],
-        typeFilter: -1,
         userQuery: "a!a",
-        error: '`!` can only be at the end of an ident',
+        error: 'Unexpected `!`: it can only be at the end of an ident',
     },
     {
+        query: "a!!",
         elems: [],
         foundElems: 0,
         original: "a!!",
         returned: [],
-        typeFilter: -1,
         userQuery: "a!!",
         error: 'Cannot have more than one `!` in an ident',
     },
+    {
+        query: "mod:a!",
+        elems: [],
+        foundElems: 0,
+        original: "mod:a!",
+        returned: [],
+        userQuery: "mod:a!",
+        error: 'Invalid search type: macro `!` and `mod` both specified',
+    },
+    {
+        query: "mod:!",
+        elems: [],
+        foundElems: 0,
+        original: "mod:!",
+        returned: [],
+        userQuery: "mod:!",
+        error: 'Invalid search type: primitive never type `!` and `mod` both specified',
+    },
+    {
+        query: "a!::a",
+        elems: [],
+        foundElems: 0,
+        original: "a!::a",
+        returned: [],
+        userQuery: "a!::a",
+        error: 'Cannot have associated items in macros',
+    },
+    {
+        query: "a<",
+        elems: [],
+        foundElems: 0,
+        original: "a<",
+        returned: [],
+        userQuery: "a<",
+        error: "Unclosed `<`",
+    },
 ];