about summary refs log tree commit diff
path: root/src/test/rustdoc-js-std/parser-errors.js
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2022-01-09 15:12:46 +0100
committerGuillaume Gomez <guillaume.gomez@huawei.com>2022-04-18 20:59:08 +0200
commit99d552092c7a0c154b98c8d5120b1e3ad729cfcd (patch)
tree39eeeb6fd55b90cea62a91447c2c96d7305e436b /src/test/rustdoc-js-std/parser-errors.js
parent264064df36e055c19af2c82145bbbe616b32fb02 (diff)
downloadrust-99d552092c7a0c154b98c8d5120b1e3ad729cfcd.tar.gz
rust-99d552092c7a0c154b98c8d5120b1e3ad729cfcd.zip
Make query parser more strict and improve display of errors
Diffstat (limited to 'src/test/rustdoc-js-std/parser-errors.js')
-rw-r--r--src/test/rustdoc-js-std/parser-errors.js139
1 files changed, 138 insertions, 1 deletions
diff --git a/src/test/rustdoc-js-std/parser-errors.js b/src/test/rustdoc-js-std/parser-errors.js
index 887ac38f417..369b8c89a66 100644
--- a/src/test/rustdoc-js-std/parser-errors.js
+++ b/src/test/rustdoc-js-std/parser-errors.js
@@ -1,4 +1,21 @@
-const QUERY = ['<"P">', '"P" "P"', 'P "P"', '"p" p', '"const": p'];
+const QUERY = [
+    '<"P">',
+    '"P" "P"',
+    'P "P"',
+    '"p" p',
+    '"const": p',
+    "<:a>", "<::a>",
+    "((a))",
+    "->,a",
+    "(p -> p",
+    "::a::b",
+    "a::::b",
+    "a::b::",
+    ":a",
+    "a b:",
+    "a (b:",
+    "{:",
+];
 
 const PARSED = [
     {
@@ -51,4 +68,124 @@ const PARSED = [
         userQuery: "\"const\": p",
         error: "You cannot use quotes on type filter",
     },
+    {
+        args: [],
+        elems: [],
+        foundElems: 0,
+        original: "<:a>",
+        returned: [],
+        typeFilter: -1,
+        userQuery: "<:a>",
+        error: "Unexpected `:` after `<`",
+    },
+    {
+        args: [],
+        elems: [],
+        foundElems: 0,
+        original: "<::a>",
+        returned: [],
+        typeFilter: -1,
+        userQuery: "<::a>",
+        error: "Unexpected `::`: paths cannot start with `::`",
+    },
+    {
+        args: [],
+        elems: [],
+        foundElems: 0,
+        original: "((a))",
+        returned: [],
+        typeFilter: -1,
+        userQuery: "((a))",
+        error: "Unexpected `(` after `(`",
+    },
+    {
+        args: [],
+        elems: [],
+        foundElems: 0,
+        original: "->,a",
+        returned: [],
+        typeFilter: -1,
+        userQuery: "->,a",
+        error: "Unexpected `,` after `->`",
+    },
+    {
+        args: [],
+        elems: [],
+        foundElems: 0,
+        original: "(p -> p",
+        returned: [],
+        typeFilter: -1,
+        userQuery: "(p -> p",
+        error: "Unexpected `-` after `(`",
+    },
+    {
+        args: [],
+        elems: [],
+        foundElems: 0,
+        original: "::a::b",
+        returned: [],
+        typeFilter: -1,
+        userQuery: "::a::b",
+        error: "Paths cannot start with `::`",
+    },
+    {
+        args: [],
+        elems: [],
+        foundElems: 0,
+        original: "a::::b",
+        returned: [],
+        typeFilter: -1,
+        userQuery: "a::::b",
+        error: "Unexpected `::::`",
+    },
+    {
+        args: [],
+        elems: [],
+        foundElems: 0,
+        original: "a::b::",
+        returned: [],
+        typeFilter: -1,
+        userQuery: "a::b::",
+        error: "Paths cannot end with `::`",
+    },
+    {
+        args: [],
+        elems: [],
+        foundElems: 0,
+        original: ":a",
+        returned: [],
+        typeFilter: -1,
+        userQuery: ":a",
+        error: "Expected type filter before `:`",
+    },
+    {
+        args: [],
+        elems: [],
+        foundElems: 0,
+        original: "a b:",
+        returned: [],
+        typeFilter: -1,
+        userQuery: "a b:",
+        error: "Unexpected `:`",
+    },
+    {
+        args: [],
+        elems: [],
+        foundElems: 0,
+        original: "a (b:",
+        returned: [],
+        typeFilter: -1,
+        userQuery: "a (b:",
+        error: "Unexpected `:` after `(`",
+    },
+    {
+        args: [],
+        elems: [],
+        foundElems: 0,
+        original: "{:",
+        returned: [],
+        typeFilter: -1,
+        userQuery: "{:",
+        error: "Unknown type filter `{`",
+    },
 ];