diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
commit | dc0db358abe19481e475e10c32149b53370f1a1c (patch) | |
tree | ab8ce99c4b255ce46f99ef402c27916055b899ee /tests/rustdoc-js-std | |
parent | Releasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff) | |
download | rustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip |
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
43 files changed, 807 insertions, 309 deletions
diff --git a/tests/rustdoc-js-std/alias-1.js b/tests/rustdoc-js-std/alias-1.js index 7c6327fcd..b27b3da21 100644 --- a/tests/rustdoc-js-std/alias-1.js +++ b/tests/rustdoc-js-std/alias-1.js @@ -1,6 +1,5 @@ -const QUERY = '&'; - const EXPECTED = { + 'query': '&', 'others': [ { 'path': 'std', 'name': 'reference' }, ], diff --git a/tests/rustdoc-js-std/alias-2.js b/tests/rustdoc-js-std/alias-2.js index 798fa29ef..5735b573b 100644 --- a/tests/rustdoc-js-std/alias-2.js +++ b/tests/rustdoc-js-std/alias-2.js @@ -1,6 +1,5 @@ -const QUERY = '+'; - const EXPECTED = { + 'query': '+', 'others': [ { 'path': 'std::ops', 'name': 'AddAssign' }, { 'path': 'std::ops', 'name': 'Add' }, diff --git a/tests/rustdoc-js-std/alias-3.js b/tests/rustdoc-js-std/alias-3.js index 392b1e818..ed3776b3c 100644 --- a/tests/rustdoc-js-std/alias-3.js +++ b/tests/rustdoc-js-std/alias-3.js @@ -1,6 +1,5 @@ -const QUERY = '!'; - const EXPECTED = { + 'query': '!', 'others': [ { 'path': 'std', 'name': 'never' }, ], diff --git a/tests/rustdoc-js-std/alias-4.js b/tests/rustdoc-js-std/alias-4.js index bf2bb4d29..35840a472 100644 --- a/tests/rustdoc-js-std/alias-4.js +++ b/tests/rustdoc-js-std/alias-4.js @@ -1,6 +1,5 @@ -const QUERY = '<'; - const EXPECTED = { + 'query': '<', 'others': [ { 'name': 'Ord' }, ], diff --git a/tests/rustdoc-js-std/alias.js b/tests/rustdoc-js-std/alias.js index 2b709c991..bf707fa03 100644 --- a/tests/rustdoc-js-std/alias.js +++ b/tests/rustdoc-js-std/alias.js @@ -1,8 +1,7 @@ // ignore-order -const QUERY = '['; - const EXPECTED = { + 'query': '[', 'others': [ { 'path': 'std', 'name': 'slice' }, { 'path': 'std::ops', 'name': 'IndexMut' }, diff --git a/tests/rustdoc-js-std/asrawfd.js b/tests/rustdoc-js-std/asrawfd.js index 369a34f9c..5b3cfeabb 100644 --- a/tests/rustdoc-js-std/asrawfd.js +++ b/tests/rustdoc-js-std/asrawfd.js @@ -1,8 +1,7 @@ // ignore-order -const QUERY = 'RawFd::as_raw_fd'; - const EXPECTED = { + 'query': 'RawFd::as_raw_fd', 'others': [ // Reproduction test for https://github.com/rust-lang/rust/issues/78724 // Validate that type alias methods get the correct path. diff --git a/tests/rustdoc-js-std/basic.js b/tests/rustdoc-js-std/basic.js index 824cac710..baff24b0a 100644 --- a/tests/rustdoc-js-std/basic.js +++ b/tests/rustdoc-js-std/basic.js @@ -1,6 +1,5 @@ -const QUERY = 'String'; - const EXPECTED = { + 'query': 'String', 'others': [ { 'path': 'std::string', 'name': 'String' }, { 'path': 'std::ffi', 'name': 'CString' }, diff --git a/tests/rustdoc-js-std/bufread-fill-buf.js b/tests/rustdoc-js-std/bufread-fill-buf.js new file mode 100644 index 000000000..3828cf760 --- /dev/null +++ b/tests/rustdoc-js-std/bufread-fill-buf.js @@ -0,0 +1,13 @@ +// ignore-order + +const EXPECTED = [ + { + 'query': 'bufread -> result<u8>', + 'others': [ + { 'path': 'std::io::Split', 'name': 'next' }, + { 'path': 'std::boxed::Box', 'name': 'fill_buf' }, + { 'path': 'std::io::Chain', 'name': 'fill_buf' }, + { 'path': 'std::io::Take', 'name': 'fill_buf' }, + ], + }, +]; diff --git a/tests/rustdoc-js-std/deduplication.js b/tests/rustdoc-js-std/deduplication.js index f02f6cf55..51279dd5e 100644 --- a/tests/rustdoc-js-std/deduplication.js +++ b/tests/rustdoc-js-std/deduplication.js @@ -1,8 +1,7 @@ // ignore-order -const QUERY = 'is_nan'; - const EXPECTED = { + 'query': 'is_nan', 'others': [ { 'path': 'std::f32', 'name': 'is_nan' }, { 'path': 'std::f64', 'name': 'is_nan' }, diff --git a/tests/rustdoc-js-std/enum-option.js b/tests/rustdoc-js-std/enum-option.js index 902e09069..216dafe3b 100644 --- a/tests/rustdoc-js-std/enum-option.js +++ b/tests/rustdoc-js-std/enum-option.js @@ -1,6 +1,5 @@ -const QUERY = 'enum:Option'; - const EXPECTED = { + 'query': 'enum:Option', 'others': [ { 'path': 'std::option', 'name': 'Option' }, ], diff --git a/tests/rustdoc-js-std/filter-crate.js b/tests/rustdoc-js-std/filter-crate.js index b47a1fefa..95f2969d2 100644 --- a/tests/rustdoc-js-std/filter-crate.js +++ b/tests/rustdoc-js-std/filter-crate.js @@ -1,9 +1,9 @@ // exact-check -const QUERY = '"hashmap"'; const FILTER_CRATE = 'core'; const EXPECTED = { + 'query': 'hashmap', 'others': [ ], }; diff --git a/tests/rustdoc-js-std/fn-forget.js b/tests/rustdoc-js-std/fn-forget.js index 66a5fcaa7..addecf4e4 100644 --- a/tests/rustdoc-js-std/fn-forget.js +++ b/tests/rustdoc-js-std/fn-forget.js @@ -1,6 +1,5 @@ -const QUERY = 'fn:forget'; - const EXPECTED = { + 'query': 'fn:forget', 'others': [ { 'path': 'std::mem', 'name': 'forget' }, { 'path': 'std::fmt', 'name': 'format' }, diff --git a/tests/rustdoc-js-std/from_u.js b/tests/rustdoc-js-std/from_u.js index e3f3cd436..7c9375ba5 100644 --- a/tests/rustdoc-js-std/from_u.js +++ b/tests/rustdoc-js-std/from_u.js @@ -1,6 +1,5 @@ -const QUERY = 'from_u'; - const EXPECTED = { + 'query': 'from_u', 'others': [ { 'path': 'std::char', 'name': 'from_u32' }, { 'path': 'std::str', 'name': 'from_utf8' }, diff --git a/tests/rustdoc-js-std/keyword.js b/tests/rustdoc-js-std/keyword.js index 868ddd7b6..b85ba3413 100644 --- a/tests/rustdoc-js-std/keyword.js +++ b/tests/rustdoc-js-std/keyword.js @@ -1,8 +1,7 @@ // ignore-order -const QUERY = 'fn'; - const EXPECTED = { + 'query': 'fn', 'others': [ { 'path': 'std', 'name': 'fn', ty: 15 }, // 15 is for primitive types { 'path': 'std', 'name': 'fn', ty: 21 }, // 21 is for keywords diff --git a/tests/rustdoc-js-std/macro-check.js b/tests/rustdoc-js-std/macro-check.js index 242e0cbf5..c22b1753f 100644 --- a/tests/rustdoc-js-std/macro-check.js +++ b/tests/rustdoc-js-std/macro-check.js @@ -1,8 +1,7 @@ // ignore-order -const QUERY = 'panic'; - const EXPECTED = { + 'query': 'panic', 'others': [ { 'path': 'std', 'name': 'panic', ty: 14 }, // 15 is for macros { 'path': 'std', 'name': 'panic', ty: 0 }, // 0 is for modules diff --git a/tests/rustdoc-js-std/macro-print.js b/tests/rustdoc-js-std/macro-print.js index 1b4c7b405..2ef1c89e4 100644 --- a/tests/rustdoc-js-std/macro-print.js +++ b/tests/rustdoc-js-std/macro-print.js @@ -1,6 +1,5 @@ -const QUERY = 'macro:print'; - const EXPECTED = { + 'query': 'macro:print', 'others': [ { 'path': 'std', 'name': 'print' }, { 'path': 'std', 'name': 'println' }, diff --git a/tests/rustdoc-js-std/never.js b/tests/rustdoc-js-std/never.js index 392b1e818..27d415b5e 100644 --- a/tests/rustdoc-js-std/never.js +++ b/tests/rustdoc-js-std/never.js @@ -1,7 +1,14 @@ -const QUERY = '!'; - -const EXPECTED = { - 'others': [ - { 'path': 'std', 'name': 'never' }, - ], -}; +const EXPECTED = [ + { + 'query': '!', + 'others': [ + { 'path': 'std', 'name': 'never' }, + ], + }, + { + 'query': '!::clone', + 'others': [ + { 'path': 'std::never', 'name': 'clone' }, + ], + }, +]; diff --git a/tests/rustdoc-js-std/option-type-signatures.js b/tests/rustdoc-js-std/option-type-signatures.js index 6bf421a21..259978506 100644 --- a/tests/rustdoc-js-std/option-type-signatures.js +++ b/tests/rustdoc-js-std/option-type-signatures.js @@ -1,18 +1,22 @@ -const QUERY = [ - 'option, fnonce -> option', - 'option -> default', -]; - const EXPECTED = [ { + 'query': 'option, fnonce -> option', 'others': [ { 'path': 'std::option::Option', 'name': 'map' }, ], }, { + 'query': 'option -> default', 'others': [ { 'path': 'std::option::Option', 'name': 'unwrap_or_default' }, { 'path': 'std::option::Option', 'name': 'get_or_insert_default' }, ], }, + { + 'query': 'option -> []', + 'others': [ + { 'path': 'std::option::Option', 'name': 'as_slice' }, + { 'path': 'std::option::Option', 'name': 'as_mut_slice' }, + ], + }, ]; diff --git a/tests/rustdoc-js-std/osstring-to-string.js b/tests/rustdoc-js-std/osstring-to-string.js new file mode 100644 index 000000000..17bb602a5 --- /dev/null +++ b/tests/rustdoc-js-std/osstring-to-string.js @@ -0,0 +1,9 @@ +// exact-match + +// https://github.com/rust-lang/rust/issues/60485#issuecomment-663900624 +const EXPECTED = { + 'query': 'OsString -> String', + 'others': [ + { 'path': 'std::ffi::OsString', 'name': 'into_string' }, + ] +}; 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, + }, ]; diff --git a/tests/rustdoc-js-std/parser-filter.js b/tests/rustdoc-js-std/parser-filter.js index e23447ab7..3b9cc5b1b 100644 --- a/tests/rustdoc-js-std/parser-filter.js +++ b/tests/rustdoc-js-std/parser-filter.js @@ -1,17 +1,6 @@ -const QUERY = [ - 'fn:foo', - 'enum : foo', - 'macro<f>:foo', - 'macro!', - 'macro:mac!', - 'a::mac!', - '-> fn:foo', - '-> fn:foo<fn:bar>', - '-> fn:foo<fn:bar, enum : baz::fuzz>', -]; - const PARSED = [ { + query: 'fn:foo', elems: [{ name: "foo", fullPath: ["foo"], @@ -27,6 +16,7 @@ const PARSED = [ error: null, }, { + query: 'enum : foo', elems: [{ name: "foo", fullPath: ["foo"], @@ -42,14 +32,16 @@ const PARSED = [ error: null, }, { + query: 'macro<f>:foo', elems: [], foundElems: 0, original: "macro<f>:foo", returned: [], userQuery: "macro<f>:foo", - error: "Unexpected `<` in type filter", + error: "Unexpected `<` in type filter (before `:`)", }, { + query: 'macro!', elems: [{ name: "macro", fullPath: ["macro"], @@ -65,6 +57,7 @@ const PARSED = [ error: null, }, { + query: 'macro:mac!', elems: [{ name: "mac", fullPath: ["mac"], @@ -80,6 +73,7 @@ const PARSED = [ error: null, }, { + query: 'a::mac!', elems: [{ name: "a::mac", fullPath: ["a", "mac"], @@ -95,6 +89,7 @@ const PARSED = [ error: null, }, { + query: '-> fn:foo', elems: [], foundElems: 1, original: "-> fn:foo", @@ -110,6 +105,7 @@ const PARSED = [ error: null, }, { + query: '-> fn:foo<fn:bar>', elems: [], foundElems: 1, original: "-> fn:foo<fn:bar>", @@ -134,6 +130,7 @@ const PARSED = [ error: null, }, { + query: '-> fn:foo<fn:bar, enum : baz::fuzz>', elems: [], foundElems: 1, original: "-> fn:foo<fn:bar, enum : baz::fuzz>", diff --git a/tests/rustdoc-js-std/parser-generics.js b/tests/rustdoc-js-std/parser-generics.js index 5a2266dbe..726ee56c2 100644 --- a/tests/rustdoc-js-std/parser-generics.js +++ b/tests/rustdoc-js-std/parser-generics.js @@ -1,14 +1,6 @@ -const QUERY = [ - 'A<B<C<D>, E>', - 'p<> u8', - '"p"<a>', - 'p<u<x>>', - 'p<u<x>, r>', - 'p<u<x, r>>', -]; - const PARSED = [ { + query: 'A<B<C<D>, E>', elems: [], foundElems: 0, original: 'A<B<C<D>, E>', @@ -17,6 +9,7 @@ const PARSED = [ error: 'Unclosed `<`', }, { + query: 'p<>,u8', elems: [ { name: "p", @@ -36,12 +29,13 @@ const PARSED = [ }, ], foundElems: 2, - original: "p<> u8", + original: "p<>,u8", returned: [], - userQuery: "p<> u8", + userQuery: "p<>,u8", error: null, }, { + query: '"p"<a>', elems: [ { name: "p", @@ -67,6 +61,7 @@ const PARSED = [ error: null, }, { + query: 'p<u<x>>', elems: [ { name: "p", @@ -100,6 +95,7 @@ const PARSED = [ error: null, }, { + query: 'p<u<x>, r>', elems: [ { name: "p", @@ -140,6 +136,7 @@ const PARSED = [ error: null, }, { + query: 'p<u<x, r>>', elems: [ { name: "p", diff --git a/tests/rustdoc-js-std/parser-ident.js b/tests/rustdoc-js-std/parser-ident.js index be42b7aa4..f65a7ce66 100644 --- a/tests/rustdoc-js-std/parser-ident.js +++ b/tests/rustdoc-js-std/parser-ident.js @@ -1,14 +1,6 @@ -const QUERY = [ - "R<!>", - "!", - "a!", - "a!::b", - "!::b", - "a!::b!", -]; - const PARSED = [ { + query: "R<!>", elems: [{ name: "r", fullPath: ["r"], @@ -16,11 +8,12 @@ const PARSED = [ pathLast: "r", generics: [ { - name: "!", - fullPath: ["!"], + name: "never", + fullPath: ["never"], pathWithoutLast: [], - pathLast: "!", + pathLast: "never", generics: [], + typeFilter: 15, }, ], typeFilter: -1, @@ -32,13 +25,14 @@ const PARSED = [ error: null, }, { + query: "!", elems: [{ - name: "!", - fullPath: ["!"], + name: "never", + fullPath: ["never"], pathWithoutLast: [], - pathLast: "!", + pathLast: "never", generics: [], - typeFilter: -1, + typeFilter: 15, }], foundElems: 1, original: "!", @@ -47,6 +41,7 @@ const PARSED = [ error: null, }, { + query: "a!", elems: [{ name: "a", fullPath: ["a"], @@ -62,6 +57,7 @@ const PARSED = [ error: null, }, { + query: "a!::b", elems: [], foundElems: 0, original: "a!::b", @@ -70,10 +66,20 @@ const PARSED = [ error: "Cannot have associated items in macros", }, { + query: "!<T>", + elems: [], + foundElems: 0, + original: "!<T>", + returned: [], + userQuery: "!<t>", + error: "Never type `!` does not accept generic parameters", + }, + { + query: "!::b", elems: [{ name: "!::b", - fullPath: ["!", "b"], - pathWithoutLast: ["!"], + fullPath: ["never", "b"], + pathWithoutLast: ["never"], pathLast: "b", generics: [], typeFilter: -1, @@ -85,6 +91,59 @@ const PARSED = [ error: null, }, { + query: "b::!", + elems: [], + foundElems: 0, + original: "b::!", + returned: [], + userQuery: "b::!", + error: "Never type `!` is not associated item", + }, + { + query: "!::!", + elems: [], + foundElems: 0, + original: "!::!", + returned: [], + userQuery: "!::!", + error: "Never type `!` is not associated item", + }, + { + query: "b::!::c", + elems: [], + foundElems: 0, + original: "b::!::c", + returned: [], + userQuery: "b::!::c", + error: "Never type `!` is not associated item", + }, + { + query: "!::b<T>", + elems: [{ + name: "!::b", + fullPath: ["never", "b"], + pathWithoutLast: ["never"], + pathLast: "b", + generics: [ + { + name: "t", + fullPath: ["t"], + pathWithoutLast: [], + pathLast: "t", + generics: [], + typeFilter: -1, + } + ], + typeFilter: -1, + }], + foundElems: 1, + original: "!::b<T>", + returned: [], + userQuery: "!::b<t>", + error: null, + }, + { + query: "a!::b!", elems: [], foundElems: 0, original: "a!::b!", diff --git a/tests/rustdoc-js-std/parser-literal.js b/tests/rustdoc-js-std/parser-literal.js index 3a31d1bdd..87c06224d 100644 --- a/tests/rustdoc-js-std/parser-literal.js +++ b/tests/rustdoc-js-std/parser-literal.js @@ -1,7 +1,6 @@ -const QUERY = ['R<P>']; - const PARSED = [ { + query: 'R<P>', elems: [{ name: "r", fullPath: ["r"], diff --git a/tests/rustdoc-js-std/parser-paths.js b/tests/rustdoc-js-std/parser-paths.js index f3e421f5f..8d4dedf3f 100644 --- a/tests/rustdoc-js-std/parser-paths.js +++ b/tests/rustdoc-js-std/parser-paths.js @@ -1,7 +1,6 @@ -const QUERY = ['A::B', 'A::B,C', 'A::B<f>,C', 'mod::a']; - const PARSED = [ { + query: 'A::B', elems: [{ name: "a::b", fullPath: ["a", "b"], @@ -17,6 +16,7 @@ const PARSED = [ error: null, }, { + query: 'A::B,C', elems: [ { name: "a::b", @@ -42,6 +42,7 @@ const PARSED = [ error: null, }, { + query: 'A::B<f>,C', elems: [ { name: "a::b", @@ -75,6 +76,7 @@ const PARSED = [ error: null, }, { + query: 'mod::a', elems: [{ name: "mod::a", fullPath: ["mod", "a"], diff --git a/tests/rustdoc-js-std/parser-quote.js b/tests/rustdoc-js-std/parser-quote.js index d5d67cac8..731673cf4 100644 --- a/tests/rustdoc-js-std/parser-quote.js +++ b/tests/rustdoc-js-std/parser-quote.js @@ -1,15 +1,6 @@ -const QUERY = [ - '-> "p"', - '"p",', - '"p" -> a', - '"a" -> "p"', - '->"-"', - '"a', - '""', -]; - const PARSED = [ { + query: '-> "p"', elems: [], foundElems: 1, original: '-> "p"', @@ -25,6 +16,7 @@ const PARSED = [ error: null, }, { + query: '"p",', elems: [{ name: "p", fullPath: ["p"], @@ -40,14 +32,16 @@ const PARSED = [ error: null, }, { + query: '"p" -> a', elems: [], foundElems: 0, original: '"p" -> a', returned: [], userQuery: '"p" -> 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: '"a" -> "p"', elems: [], foundElems: 0, original: '"a" -> "p"', @@ -56,6 +50,7 @@ const PARSED = [ error: "Cannot have more than one literal search element", }, { + query: '->"-"', elems: [], foundElems: 0, original: '->"-"', @@ -64,6 +59,7 @@ const PARSED = [ error: 'Unexpected `-` in a string element', }, { + query: '"a', elems: [], foundElems: 0, original: '"a', @@ -72,6 +68,7 @@ const PARSED = [ error: 'Unclosed `"`', }, { + query: '""', elems: [], foundElems: 0, original: '""', diff --git a/tests/rustdoc-js-std/parser-returned.js b/tests/rustdoc-js-std/parser-returned.js index c29813190..6ea866091 100644 --- a/tests/rustdoc-js-std/parser-returned.js +++ b/tests/rustdoc-js-std/parser-returned.js @@ -1,13 +1,6 @@ -const QUERY = [ - "-> F<P>", - "-> P", - "->,a", - "aaaaa->a", - "-> !", -]; - const PARSED = [ { + query: "-> F<P>", elems: [], foundElems: 1, original: "-> F<P>", @@ -31,6 +24,7 @@ const PARSED = [ error: null, }, { + query: "-> P", elems: [], foundElems: 1, original: "-> P", @@ -46,6 +40,7 @@ const PARSED = [ error: null, }, { + query: "->,a", elems: [], foundElems: 1, original: "->,a", @@ -61,6 +56,7 @@ const PARSED = [ error: null, }, { + query: "aaaaa->a", elems: [{ name: "aaaaa", fullPath: ["aaaaa"], @@ -83,16 +79,17 @@ const PARSED = [ error: null, }, { + query: "-> !", elems: [], foundElems: 1, original: "-> !", returned: [{ - name: "!", - fullPath: ["!"], + name: "never", + fullPath: ["never"], pathWithoutLast: [], - pathLast: "!", + pathLast: "never", generics: [], - typeFilter: -1, + typeFilter: 15, }], userQuery: "-> !", error: null, diff --git a/tests/rustdoc-js-std/parser-separators.js b/tests/rustdoc-js-std/parser-separators.js index fc8c5114c..00c489b51 100644 --- a/tests/rustdoc-js-std/parser-separators.js +++ b/tests/rustdoc-js-std/parser-separators.js @@ -1,17 +1,26 @@ // ignore-tidy-tab -const QUERY = [ - 'aaaaaa b', - 'a b', - 'a,b', - 'a\tb', - 'a<b c>', - 'a<b,c>', - 'a<b\tc>', -]; - const PARSED = [ { + query: 'aaaaaa b', + elems: [ + { + name: 'aaaaaa\tb', + fullPath: ['aaaaaa', 'b'], + pathWithoutLast: ['aaaaaa'], + pathLast: 'b', + generics: [], + typeFilter: -1, + }, + ], + foundElems: 1, + original: "aaaaaa b", + returned: [], + userQuery: "aaaaaa b", + error: null, + }, + { + query: "aaaaaa, b", elems: [ { name: 'aaaaaa', @@ -31,37 +40,31 @@ const PARSED = [ }, ], foundElems: 2, - original: "aaaaaa b", + original: "aaaaaa, b", returned: [], - userQuery: "aaaaaa b", + userQuery: "aaaaaa, b", error: null, }, { + query: 'a b', elems: [ { - name: 'a', - fullPath: ['a'], - pathWithoutLast: [], - pathLast: 'a', - generics: [], - typeFilter: -1, - }, - { - name: 'b', - fullPath: ['b'], - pathWithoutLast: [], + name: 'a b', + fullPath: ['a', 'b'], + pathWithoutLast: ['a'], pathLast: 'b', generics: [], typeFilter: -1, }, ], - foundElems: 2, + foundElems: 1, original: "a b", returned: [], userQuery: "a b", error: null, }, { + query: 'a,b', elems: [ { name: 'a', @@ -87,31 +90,25 @@ const PARSED = [ error: null, }, { + query: 'a\tb', elems: [ { - name: 'a', - fullPath: ['a'], - pathWithoutLast: [], - pathLast: 'a', - generics: [], - typeFilter: -1, - }, - { - name: 'b', - fullPath: ['b'], - pathWithoutLast: [], + name: 'a\tb', + fullPath: ['a', 'b'], + pathWithoutLast: ['a'], pathLast: 'b', generics: [], typeFilter: -1, }, ], - foundElems: 2, + foundElems: 1, original: "a\tb", returned: [], userQuery: "a\tb", error: null, }, { + query: 'a<b c>', elems: [ { name: 'a', @@ -120,16 +117,9 @@ const PARSED = [ pathLast: 'a', generics: [ { - name: 'b', - fullPath: ['b'], - pathWithoutLast: [], - pathLast: 'b', - generics: [], - }, - { - name: 'c', - fullPath: ['c'], - pathWithoutLast: [], + name: 'b c', + fullPath: ['b', 'c'], + pathWithoutLast: ['b'], pathLast: 'c', generics: [], }, @@ -144,6 +134,7 @@ const PARSED = [ error: null, }, { + query: 'a<b,c>', elems: [ { name: 'a', @@ -176,6 +167,7 @@ const PARSED = [ error: null, }, { + query: 'a<b\tc>', elems: [ { name: 'a', @@ -184,16 +176,9 @@ const PARSED = [ pathLast: 'a', generics: [ { - name: 'b', - fullPath: ['b'], - pathWithoutLast: [], - pathLast: 'b', - generics: [], - }, - { - name: 'c', - fullPath: ['c'], - pathWithoutLast: [], + name: 'b\tc', + fullPath: ['b', 'c'], + pathWithoutLast: ['b'], pathLast: 'c', generics: [], }, diff --git a/tests/rustdoc-js-std/parser-slice-array.js b/tests/rustdoc-js-std/parser-slice-array.js new file mode 100644 index 000000000..c22b7870d --- /dev/null +++ b/tests/rustdoc-js-std/parser-slice-array.js @@ -0,0 +1,305 @@ +const PARSED = [ + { + query: '[[[D, []]]', + elems: [], + foundElems: 0, + original: '[[[D, []]]', + returned: [], + userQuery: '[[[d, []]]', + error: 'Unclosed `[`', + }, + { + query: '[[[D, []]]]', + elems: [ + { + name: "[]", + fullPath: ["[]"], + pathWithoutLast: [], + pathLast: "[]", + generics: [ + { + name: "[]", + fullPath: ["[]"], + pathWithoutLast: [], + pathLast: "[]", + generics: [ + { + name: "[]", + fullPath: ["[]"], + pathWithoutLast: [], + pathLast: "[]", + generics: [ + { + name: "d", + fullPath: ["d"], + pathWithoutLast: [], + pathLast: "d", + generics: [], + typeFilter: -1, + }, + { + name: "[]", + fullPath: ["[]"], + pathWithoutLast: [], + pathLast: "[]", + generics: [], + typeFilter: 15, + }, + ], + typeFilter: 15, + }, + ], + typeFilter: 15, + }, + ], + typeFilter: 15, + }, + ], + foundElems: 1, + original: '[[[D, []]]]', + returned: [], + userQuery: '[[[d, []]]]', + error: null, + }, + { + query: '[],u8', + elems: [ + { + name: "[]", + fullPath: ["[]"], + pathWithoutLast: [], + pathLast: "[]", + generics: [], + typeFilter: 15, + }, + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + ], + foundElems: 2, + original: "[],u8", + returned: [], + userQuery: "[],u8", + error: null, + }, + { + query: '[u8]', + elems: [ + { + name: "[]", + fullPath: ["[]"], + pathWithoutLast: [], + pathLast: "[]", + generics: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: 15, + }, + ], + foundElems: 1, + original: "[u8]", + returned: [], + userQuery: "[u8]", + error: null, + }, + { + query: '[u8,u8]', + elems: [ + { + name: "[]", + fullPath: ["[]"], + pathWithoutLast: [], + pathLast: "[]", + generics: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: 15, + }, + ], + foundElems: 1, + original: "[u8,u8]", + returned: [], + userQuery: "[u8,u8]", + error: null, + }, + { + query: '[u8<u8>]', + elems: [ + { + name: "[]", + fullPath: ["[]"], + pathWithoutLast: [], + pathLast: "[]", + generics: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: -1, + }, + ], + typeFilter: 15, + }, + ], + foundElems: 1, + original: "[u8<u8>]", + returned: [], + userQuery: "[u8<u8>]", + error: null, + }, + { + query: '[]', + elems: [ + { + name: "[]", + fullPath: ["[]"], + pathWithoutLast: [], + pathLast: "[]", + generics: [], + typeFilter: 15, + }, + ], + foundElems: 1, + original: "[]", + returned: [], + userQuery: "[]", + error: null, + }, + { + query: '[>', + elems: [], + foundElems: 0, + original: "[>", + returned: [], + userQuery: "[>", + error: "Unexpected `>` after `[`", + }, + { + query: '[<', + elems: [], + foundElems: 0, + original: "[<", + returned: [], + userQuery: "[<", + error: "Found generics without a path", + }, + { + query: '[a>', + elems: [], + foundElems: 0, + original: "[a>", + returned: [], + userQuery: "[a>", + error: "Unexpected `>` after `[`", + }, + { + query: '[a<', + elems: [], + foundElems: 0, + original: "[a<", + returned: [], + userQuery: "[a<", + error: "Unclosed `<`", + }, + { + query: '[a', + elems: [], + foundElems: 0, + original: "[a", + returned: [], + userQuery: "[a", + error: "Unclosed `[`", + }, + { + query: '[', + elems: [], + foundElems: 0, + original: "[", + returned: [], + userQuery: "[", + error: "Unclosed `[`", + }, + { + query: ']', + elems: [], + foundElems: 0, + original: "]", + returned: [], + userQuery: "]", + error: "Unexpected `]`", + }, + { + query: 'primitive:[u8]', + elems: [ + { + name: "[]", + fullPath: ["[]"], + pathWithoutLast: [], + pathLast: "[]", + generics: [ + { + name: "u8", + fullPath: ["u8"], + pathWithoutLast: [], + pathLast: "u8", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: 15, + }, + ], + foundElems: 1, + original: "primitive:[u8]", + returned: [], + userQuery: "primitive:[u8]", + error: null, + }, + { + query: 'macro:[u8]', + elems: [], + foundElems: 0, + original: "macro:[u8]", + returned: [], + userQuery: "macro:[u8]", + error: "Invalid search type: primitive `[]` and `macro` both specified", + }, +]; diff --git a/tests/rustdoc-js-std/parser-weird-queries.js b/tests/rustdoc-js-std/parser-weird-queries.js index dc1049a70..720ef66c1 100644 --- a/tests/rustdoc-js-std/parser-weird-queries.js +++ b/tests/rustdoc-js-std/parser-weird-queries.js @@ -1,68 +1,44 @@ // 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 QUERY = [ - 'a b', - 'a b', - 'a,b(c)', - 'aaa,a', - ',,,,', - 'mod :', - 'mod\t:', -]; const PARSED = [ { + query: 'a b', elems: [ { - name: "a", - fullPath: ["a"], - pathWithoutLast: [], - pathLast: "a", - generics: [], - typeFilter: -1, - }, - { - name: "b", - fullPath: ["b"], - pathWithoutLast: [], + name: "a b", + fullPath: ["a", "b"], + pathWithoutLast: ["a"], pathLast: "b", generics: [], - typeFilter: -1, }, ], - foundElems: 2, + foundElems: 1, 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: [], + name: "a b", + fullPath: ["a", "b"], + pathWithoutLast: ["a"], pathLast: "b", generics: [], - typeFilter: -1, }, ], - foundElems: 2, + foundElems: 1, original: "a b", returned: [], userQuery: "a b", error: null, }, { + query: 'a,b(c)', elems: [], foundElems: 0, original: "a,b(c)", @@ -71,6 +47,7 @@ const PARSED = [ error: "Unexpected `(`", }, { + query: 'aaa,a', elems: [ { name: "aaa", @@ -78,7 +55,6 @@ const PARSED = [ pathWithoutLast: [], pathLast: "aaa", generics: [], - typeFilter: -1, }, { name: "a", @@ -86,7 +62,6 @@ const PARSED = [ pathWithoutLast: [], pathLast: "a", generics: [], - typeFilter: -1, }, ], foundElems: 2, @@ -96,6 +71,7 @@ const PARSED = [ error: null, }, { + query: ',,,,', elems: [], foundElems: 0, original: ",,,,", @@ -104,19 +80,21 @@ const PARSED = [ error: null, }, { + query: 'mod :', elems: [], foundElems: 0, original: 'mod :', returned: [], userQuery: 'mod :', - error: "Unexpected `:` (expected path after type filter)", + error: "Unexpected `:` (expected path after type filter `mod:`)", }, { + query: 'mod\t:', elems: [], foundElems: 0, original: 'mod\t:', returned: [], userQuery: 'mod\t:', - error: "Unexpected `:` (expected path after type filter)", + error: "Unexpected `:` (expected path after type filter `mod:`)", }, ]; diff --git a/tests/rustdoc-js-std/path-ordering.js b/tests/rustdoc-js-std/path-ordering.js index 7dcdd4023..c3d61d238 100644 --- a/tests/rustdoc-js-std/path-ordering.js +++ b/tests/rustdoc-js-std/path-ordering.js @@ -1,7 +1,6 @@ -const QUERY = 'hashset::insert'; - const EXPECTED = { - 'others': [ + query: 'hashset::insert', + others: [ // ensure hashset::insert comes first { 'path': 'std::collections::hash_set::HashSet', 'name': 'insert' }, { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert' }, diff --git a/tests/rustdoc-js-std/primitive.js b/tests/rustdoc-js-std/primitive.js index e5690383e..737e429bf 100644 --- a/tests/rustdoc-js-std/primitive.js +++ b/tests/rustdoc-js-std/primitive.js @@ -1,15 +1,6 @@ -const QUERY = [ - 'i8', - 'u32', - 'str', - 'char', - 'unit', - 'tuple', - 'fn', -]; - const EXPECTED = [ { + 'query': 'i8', 'others': [ { 'path': 'std', @@ -19,6 +10,7 @@ const EXPECTED = [ ] }, { + 'query': 'u32', 'others': [ { 'path': 'std', @@ -28,6 +20,7 @@ const EXPECTED = [ ] }, { + 'query': 'str', 'others': [ { 'path': 'std', @@ -37,6 +30,7 @@ const EXPECTED = [ ] }, { + 'query': 'char', 'others': [ { 'path': 'std', @@ -46,6 +40,7 @@ const EXPECTED = [ ] }, { + 'query': 'unit', 'others': [ { 'path': 'std', @@ -55,6 +50,7 @@ const EXPECTED = [ ] }, { + 'query': 'tuple', 'others': [ { 'path': 'std', @@ -64,6 +60,7 @@ const EXPECTED = [ ] }, { + 'query': 'fn', 'others': [ { 'path': 'std', diff --git a/tests/rustdoc-js-std/println-typo.js b/tests/rustdoc-js-std/println-typo.js index 7ca3ab8e5..a4dd90a44 100644 --- a/tests/rustdoc-js-std/println-typo.js +++ b/tests/rustdoc-js-std/println-typo.js @@ -1,9 +1,9 @@ // exact-check -const QUERY = 'prinltn'; const FILTER_CRATE = 'std'; const EXPECTED = { + 'query': 'prinltn', 'others': [ { 'path': 'std', 'name': 'println' }, { 'path': 'std', 'name': 'print' }, diff --git a/tests/rustdoc-js-std/quoted.js b/tests/rustdoc-js-std/quoted.js index aec8484a4..8a9275019 100644 --- a/tests/rustdoc-js-std/quoted.js +++ b/tests/rustdoc-js-std/quoted.js @@ -1,9 +1,9 @@ // ignore-order -const QUERY = '"error"'; const FILTER_CRATE = 'std'; const EXPECTED = { + 'query': '"error"', 'others': [ { 'path': 'std', 'name': 'error' }, { 'path': 'std::fmt', 'name': 'Error' }, diff --git a/tests/rustdoc-js-std/reference-shrink.js b/tests/rustdoc-js-std/reference-shrink.js index f90be6d1b..b602bbdca 100644 --- a/tests/rustdoc-js-std/reference-shrink.js +++ b/tests/rustdoc-js-std/reference-shrink.js @@ -1,8 +1,7 @@ // exact-check -const QUERY = 'reference::shrink'; - const EXPECTED = { + 'query': 'reference::shrink', // avoid including the method that's not going to be in the HTML 'others': [], }; diff --git a/tests/rustdoc-js-std/regex.js b/tests/rustdoc-js-std/regex.js index a6843c595..7dc38939a 100644 --- a/tests/rustdoc-js-std/regex.js +++ b/tests/rustdoc-js-std/regex.js @@ -1,9 +1,8 @@ // exact-check // https://github.com/rust-lang/rust/issues/103357 -const QUERY = 'regex'; - const EXPECTED = { + 'query': 'regex', 'others': [], 'in_args': [], 'returned': [], diff --git a/tests/rustdoc-js-std/return-specific-literal.js b/tests/rustdoc-js-std/return-specific-literal.js index c7c347240..86ed3aceb 100644 --- a/tests/rustdoc-js-std/return-specific-literal.js +++ b/tests/rustdoc-js-std/return-specific-literal.js @@ -1,6 +1,5 @@ -const QUERY = 'struct:"string"'; - const EXPECTED = { + 'query': 'struct:"string"', 'in_args': [ { 'path': 'std::string::String', 'name': 'ne' }, ], diff --git a/tests/rustdoc-js-std/return-specific.js b/tests/rustdoc-js-std/return-specific.js index d9a910553..be54a1c97 100644 --- a/tests/rustdoc-js-std/return-specific.js +++ b/tests/rustdoc-js-std/return-specific.js @@ -1,6 +1,5 @@ -const QUERY = 'struct:string'; - const EXPECTED = { + 'query': 'struct:string', 'in_args': [ { 'path': 'std::string::String', 'name': 'ne' }, ], diff --git a/tests/rustdoc-js-std/should-fail.js b/tests/rustdoc-js-std/should-fail.js index b85a47dc0..94f82efd9 100644 --- a/tests/rustdoc-js-std/should-fail.js +++ b/tests/rustdoc-js-std/should-fail.js @@ -1,8 +1,7 @@ // should-fail -const QUERY = 'fn'; - const EXPECTED = { + 'query': 'fn', 'others': [ { 'path': 'std', 'name': 'fn', ty: 14 }, ], diff --git a/tests/rustdoc-js-std/string-from_ut.js b/tests/rustdoc-js-std/string-from_ut.js index f9edf4408..1fff6ee28 100644 --- a/tests/rustdoc-js-std/string-from_ut.js +++ b/tests/rustdoc-js-std/string-from_ut.js @@ -1,6 +1,5 @@ -const QUERY = 'String::from_ut'; - const EXPECTED = { + 'query': 'String::from_ut', 'others': [ { 'path': 'std::string::String', 'name': 'from_utf8' }, { 'path': 'std::string::String', 'name': 'from_utf8' }, diff --git a/tests/rustdoc-js-std/struct-vec.js b/tests/rustdoc-js-std/struct-vec.js index 29609904b..dd72aaa1a 100644 --- a/tests/rustdoc-js-std/struct-vec.js +++ b/tests/rustdoc-js-std/struct-vec.js @@ -1,6 +1,5 @@ -const QUERY = 'struct:VecD'; - const EXPECTED = { + 'query': 'struct:VecD', 'others': [ { 'path': 'std::collections', 'name': 'VecDeque' }, { 'path': 'std::vec', 'name': 'Vec' }, diff --git a/tests/rustdoc-js-std/typed-query.js b/tests/rustdoc-js-std/typed-query.js index eeb3e1888..8e8464588 100644 --- a/tests/rustdoc-js-std/typed-query.js +++ b/tests/rustdoc-js-std/typed-query.js @@ -1,9 +1,9 @@ // exact-check -const QUERY = 'macro:print'; const FILTER_CRATE = 'std'; const EXPECTED = { + 'query': 'macro:print', 'others': [ { 'path': 'std', 'name': 'print' }, { 'path': 'std', 'name': 'println' }, diff --git a/tests/rustdoc-js-std/vec-new.js b/tests/rustdoc-js-std/vec-new.js index fc44a566a..9823a417a 100644 --- a/tests/rustdoc-js-std/vec-new.js +++ b/tests/rustdoc-js-std/vec-new.js @@ -1,10 +1,20 @@ -const QUERY = 'Vec::new'; - -const EXPECTED = { - 'others': [ - { 'path': 'std::vec::Vec', 'name': 'new' }, - { 'path': 'alloc::vec::Vec', 'name': 'new' }, - { 'path': 'std::vec::Vec', 'name': 'new_in' }, - { 'path': 'alloc::vec::Vec', 'name': 'new_in' }, - ], -}; +const EXPECTED = [ + { + 'query': 'Vec::new', + 'others': [ + { 'path': 'std::vec::Vec', 'name': 'new' }, + { 'path': 'alloc::vec::Vec', 'name': 'new' }, + { 'path': 'std::vec::Vec', 'name': 'new_in' }, + { 'path': 'alloc::vec::Vec', 'name': 'new_in' }, + ], + }, + { + 'query': 'Vec new', + 'others': [ + { 'path': 'std::vec::Vec', 'name': 'new' }, + { 'path': 'alloc::vec::Vec', 'name': 'new' }, + { 'path': 'std::vec::Vec', 'name': 'new_in' }, + { 'path': 'alloc::vec::Vec', 'name': 'new_in' }, + ], + }, +]; |