rust/tests/rustdoc-js-std/parser-weird-queries.js
2023-06-09 17:00:47 +02:00

121 lines
2.8 KiB
JavaScript

// 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",
fullPath: ["a"],
pathWithoutLast: [],
pathLast: "a",
generics: [],
typeFilter: -1,
},
{
name: "b",
fullPath: ["b"],
pathWithoutLast: [],
pathLast: "b",
generics: [],
typeFilter: -1,
},
],
foundElems: 2,
original: "a b",
returned: [],
userQuery: "a b",
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,
original: "a b",
returned: [],
userQuery: "a b",
error: null,
},
{
query: 'a,b(c)',
elems: [],
foundElems: 0,
original: "a,b(c)",
returned: [],
userQuery: "a,b(c)",
error: "Unexpected `(`",
},
{
query: 'aaa,a',
elems: [
{
name: "aaa",
fullPath: ["aaa"],
pathWithoutLast: [],
pathLast: "aaa",
generics: [],
typeFilter: -1,
},
{
name: "a",
fullPath: ["a"],
pathWithoutLast: [],
pathLast: "a",
generics: [],
typeFilter: -1,
},
],
foundElems: 2,
original: "aaa,a",
returned: [],
userQuery: "aaa,a",
error: null,
},
{
query: ',,,,',
elems: [],
foundElems: 0,
original: ",,,,",
returned: [],
userQuery: ",,,,",
error: null,
},
{
query: 'mod :',
elems: [],
foundElems: 0,
original: 'mod :',
returned: [],
userQuery: 'mod :',
error: "Unexpected `:` (expected path after type filter)",
},
{
query: 'mod\t:',
elems: [],
foundElems: 0,
original: 'mod\t:',
returned: [],
userQuery: 'mod\t:',
error: "Unexpected `:` (expected path after type filter)",
},
];