diff options
Diffstat (limited to 'tests/rustdoc-js-std/parser-errors.js')
-rw-r--r-- | tests/rustdoc-js-std/parser-errors.js | 292 |
1 files changed, 228 insertions, 64 deletions
diff --git a/tests/rustdoc-js-std/parser-errors.js b/tests/rustdoc-js-std/parser-errors.js index d1aa840ab..b32bfea54 100644 --- a/tests/rustdoc-js-std/parser-errors.js +++ b/tests/rustdoc-js-std/parser-errors.js @@ -1,50 +1,6 @@ -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", - "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!!", - "mod:a!", - "a!::a", - "a<", -]; - const PARSED = [ { + query: '<P>', elems: [], foundElems: 0, original: "<P>", @@ -53,6 +9,7 @@ const PARSED = [ error: "Found generics without a path", }, { + query: '-> <P>', elems: [], foundElems: 0, original: "-> <P>", @@ -61,6 +18,7 @@ const PARSED = [ error: "Found generics without a path", }, { + query: 'a<"P">', elems: [], foundElems: 0, original: "a<\"P\">", @@ -69,38 +27,61 @@ const PARSED = [ error: "Unexpected `\"` in generics", }, { + query: '"P" "P"', elems: [], foundElems: 0, original: "\"P\" \"P\"", returned: [], userQuery: "\"p\" \"p\"", + error: "Cannot have more than one element if you use quotes", + }, + { + query: '"P","P"', + elems: [], + foundElems: 0, + original: "\"P\",\"P\"", + returned: [], + userQuery: "\"p\",\"p\"", error: "Cannot have more than one literal search element", }, { + query: "P,\"P\"", elems: [], foundElems: 0, - original: "P \"P\"", + original: "P,\"P\"", returned: [], - userQuery: "p \"p\"", + 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: [], userQuery: "\"p\" p", - error: "You cannot have more than one element if you use quotes", + error: "Cannot have more than one element if you use quotes", + }, + { + query: '"p",p', + elems: [], + foundElems: 0, + original: "\"p\",p", + returned: [], + userQuery: "\"p\",p", + error: "Cannot have more than one element if you use quotes", }, { + query: '"const": p', elems: [], foundElems: 0, original: "\"const\": p", returned: [], userQuery: "\"const\": p", - error: "You cannot use quotes on type filter", + error: "Cannot use quotes on type filter", }, { + query: "a<:a>", elems: [], foundElems: 0, original: "a<:a>", @@ -109,6 +90,7 @@ const PARSED = [ error: "Expected type filter before `:`", }, { + query: "a<::a>", elems: [], foundElems: 0, original: "a<::a>", @@ -117,6 +99,7 @@ const PARSED = [ error: "Unexpected `::`: paths cannot start with `::`", }, { + query: "((a))", elems: [], foundElems: 0, original: "((a))", @@ -125,6 +108,7 @@ const PARSED = [ error: "Unexpected `(`", }, { + query: "(p -> p", elems: [], foundElems: 0, original: "(p -> p", @@ -133,6 +117,7 @@ const PARSED = [ error: "Unexpected `(`", }, { + query: "::a::b", elems: [], foundElems: 0, original: "::a::b", @@ -141,6 +126,16 @@ const PARSED = [ error: "Paths cannot start with `::`", }, { + query: " ::a::b", + elems: [], + foundElems: 0, + original: "::a::b", + returned: [], + userQuery: "::a::b", + error: "Paths cannot start with `::`", + }, + { + query: "a::::b", elems: [], foundElems: 0, original: "a::::b", @@ -149,6 +144,7 @@ const PARSED = [ error: "Unexpected `::::`", }, { + query: "a::b::", elems: [], foundElems: 0, original: "a::b::", @@ -157,6 +153,7 @@ const PARSED = [ error: "Paths cannot end with `::`", }, { + query: ":a", elems: [], foundElems: 0, original: ":a", @@ -165,14 +162,16 @@ const PARSED = [ error: "Expected type filter before `:`", }, { + query: "a,b:", elems: [], foundElems: 0, - original: "a b:", + original: "a,b:", returned: [], - userQuery: "a b:", - error: "Unexpected `:` (expected path after type filter)", + userQuery: "a,b:", + error: "Unexpected `:` (expected path after type filter `b:`)", }, { + query: "a (b:", elems: [], foundElems: 0, original: "a (b:", @@ -181,14 +180,16 @@ const PARSED = [ error: "Unexpected `(`", }, { + query: "_:", elems: [], foundElems: 0, original: "_:", returned: [], userQuery: "_:", - error: "Unexpected `:` (expected path after type filter)", + error: "Unexpected `:` (expected path after type filter `_:`)", }, { + query: "_:a", elems: [], foundElems: 0, original: "_:a", @@ -197,6 +198,7 @@ const PARSED = [ error: "Unknown type filter `_`", }, { + query: "a-bb", elems: [], foundElems: 0, original: "a-bb", @@ -205,6 +207,7 @@ const PARSED = [ error: "Unexpected `-` (did you mean `->`?)", }, { + query: "a>bb", elems: [], foundElems: 0, original: "a>bb", @@ -213,6 +216,7 @@ const PARSED = [ error: "Unexpected `>` (did you mean `->`?)", }, { + query: "ab'", elems: [], foundElems: 0, original: "ab'", @@ -221,6 +225,7 @@ const PARSED = [ error: "Unexpected `'`", }, { + query: "a->", elems: [], foundElems: 0, original: "a->", @@ -229,22 +234,43 @@ const PARSED = [ error: "Expected at least one item after `->`", }, { + query: '"p" <a>', elems: [], foundElems: 0, original: '"p" <a>', returned: [], userQuery: '"p" <a>', + error: "Cannot have more than one element if you use quotes", + }, + { + query: '"p",<a>', + elems: [], + foundElems: 0, + original: '"p",<a>', + returned: [], + userQuery: '"p",<a>', error: "Found generics without a path", }, { + query: '"p" a<a>', elems: [], foundElems: 0, original: '"p" a<a>', returned: [], userQuery: '"p" a<a>', - error: "You cannot have more than one element if you use quotes", + error: "Cannot have more than one element if you use quotes", + }, + { + query: '"p",a<a>', + elems: [], + foundElems: 0, + original: '"p",a<a>', + returned: [], + userQuery: '"p",a<a>', + error: "Cannot have more than one element if you use quotes", }, { + query: "a,<", elems: [], foundElems: 0, original: 'a,<', @@ -253,30 +279,34 @@ const PARSED = [ error: 'Found generics without a path', }, { + query: "aaaaa<>b", elems: [], foundElems: 0, original: 'aaaaa<>b', returned: [], userQuery: 'aaaaa<>b', - error: 'Expected `,`, ` `, `:` or `->`, found `b`', + error: 'Expected `,`, `:` or `->` after `>`, found `b`', }, { + query: "fn:aaaaa<>b", elems: [], foundElems: 0, original: 'fn:aaaaa<>b', returned: [], userQuery: 'fn:aaaaa<>b', - error: 'Expected `,`, ` `, `:` or `->`, found `b`', + error: 'Expected `,`, `:` or `->` after `>`, found `b`', }, { + query: "->a<>b", elems: [], foundElems: 0, original: '->a<>b', returned: [], userQuery: '->a<>b', - error: 'Expected `,` or ` `, found `b`', + error: 'Expected `,` after `>`, found `b`', }, { + query: "a<->", elems: [], foundElems: 0, original: 'a<->', @@ -285,62 +315,79 @@ const PARSED = [ error: 'Unexpected `-` after `<`', }, { + query: "a:: a", elems: [], foundElems: 0, original: 'a:: a', returned: [], userQuery: 'a:: a', - error: 'Paths cannot end with `::`', + error: 'Unexpected `:: `', }, { + query: "a ::a", elems: [], foundElems: 0, original: 'a ::a', returned: [], userQuery: 'a ::a', - error: 'Paths cannot start with `::`', + error: 'Unexpected ` ::`', }, { + query: "a<a>:", elems: [], foundElems: 0, original: "a<a>:", returned: [], userQuery: "a<a>:", - error: 'Unexpected `<` in type filter', + error: 'Unexpected `<` in type filter (before `:`)', }, { + query: "a<>:", elems: [], foundElems: 0, original: "a<>:", returned: [], userQuery: "a<>:", - error: 'Unexpected `<` in type filter', + error: 'Unexpected `<` in type filter (before `:`)', }, { + query: "a,:", elems: [], foundElems: 0, original: "a,:", returned: [], userQuery: "a,:", - error: 'Unexpected `,` in type filter', + error: 'Unexpected `,` in type filter (before `:`)', }, { + query: " a<> :", elems: [], foundElems: 0, original: "a<> :", returned: [], userQuery: "a<> :", - error: 'Unexpected `<` in type filter', + error: 'Unexpected `<` in type filter (before `:`)', }, { + query: "mod : :", elems: [], foundElems: 0, original: "mod : :", returned: [], userQuery: "mod : :", - error: 'Unexpected `:`', + error: 'Unexpected `:` (expected path after type filter `mod:`)', + }, + { + query: "mod: :", + elems: [], + foundElems: 0, + original: "mod: :", + returned: [], + userQuery: "mod: :", + error: 'Unexpected `:` (expected path after type filter `mod:`)', }, { + query: "a!a", elems: [], foundElems: 0, original: "a!a", @@ -349,6 +396,7 @@ const PARSED = [ error: 'Unexpected `!`: it can only be at the end of an ident', }, { + query: "a!!", elems: [], foundElems: 0, original: "a!!", @@ -357,6 +405,7 @@ const PARSED = [ error: 'Cannot have more than one `!` in an ident', }, { + query: "mod:a!", elems: [], foundElems: 0, original: "mod:a!", @@ -365,6 +414,16 @@ const PARSED = [ 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", @@ -373,6 +432,7 @@ const PARSED = [ error: 'Cannot have associated items in macros', }, { + query: "a<", elems: [], foundElems: 0, original: "a<", @@ -380,4 +440,108 @@ const PARSED = [ userQuery: "a<", 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, + original: "p<x> , y", + returned: [], + userQuery: "p<x> , y", + 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, + original: "p<x , y>", + returned: [], + userQuery: "p<x , y>", + 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, + original: "p ,x , y", + returned: [], + userQuery: "p ,x , y", + error: null, + }, ]; |