summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc-js-std
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/rustdoc-js-std
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/rustdoc-js-std')
-rw-r--r--tests/rustdoc-js-std/alias-1.js7
-rw-r--r--tests/rustdoc-js-std/alias-2.js10
-rw-r--r--tests/rustdoc-js-std/alias-3.js7
-rw-r--r--tests/rustdoc-js-std/alias-4.js7
-rw-r--r--tests/rustdoc-js-std/alias.js11
-rw-r--r--tests/rustdoc-js-std/asrawfd.js14
-rw-r--r--tests/rustdoc-js-std/basic.js15
-rw-r--r--tests/rustdoc-js-std/deduplication.js11
-rw-r--r--tests/rustdoc-js-std/enum-option.js7
-rw-r--r--tests/rustdoc-js-std/filter-crate.js9
-rw-r--r--tests/rustdoc-js-std/fn-forget.js8
-rw-r--r--tests/rustdoc-js-std/from_u.js9
-rw-r--r--tests/rustdoc-js-std/keyword.js10
-rw-r--r--tests/rustdoc-js-std/macro-check.js10
-rw-r--r--tests/rustdoc-js-std/macro-print.js10
-rw-r--r--tests/rustdoc-js-std/never.js7
-rw-r--r--tests/rustdoc-js-std/parser-errors.js385
-rw-r--r--tests/rustdoc-js-std/parser-filter.js43
-rw-r--r--tests/rustdoc-js-std/parser-generics.js62
-rw-r--r--tests/rustdoc-js-std/parser-ident.js93
-rw-r--r--tests/rustdoc-js-std/parser-literal.js27
-rw-r--r--tests/rustdoc-js-std/parser-paths.js90
-rw-r--r--tests/rustdoc-js-std/parser-quote.js87
-rw-r--r--tests/rustdoc-js-std/parser-returned.js99
-rw-r--r--tests/rustdoc-js-std/parser-separators.js206
-rw-r--r--tests/rustdoc-js-std/parser-weird-queries.js123
-rw-r--r--tests/rustdoc-js-std/path-ordering.js12
-rw-r--r--tests/rustdoc-js-std/primitive.js75
-rw-r--r--tests/rustdoc-js-std/quoted.js21
-rw-r--r--tests/rustdoc-js-std/return-specific-literal.js10
-rw-r--r--tests/rustdoc-js-std/return-specific.js10
-rw-r--r--tests/rustdoc-js-std/should-fail.js9
-rw-r--r--tests/rustdoc-js-std/string-from_ut.js11
-rw-r--r--tests/rustdoc-js-std/struct-vec.js8
-rw-r--r--tests/rustdoc-js-std/typed-query.js17
-rw-r--r--tests/rustdoc-js-std/vec-new.js10
36 files changed, 1550 insertions, 0 deletions
diff --git a/tests/rustdoc-js-std/alias-1.js b/tests/rustdoc-js-std/alias-1.js
new file mode 100644
index 000000000..7c6327fcd
--- /dev/null
+++ b/tests/rustdoc-js-std/alias-1.js
@@ -0,0 +1,7 @@
+const QUERY = '&';
+
+const EXPECTED = {
+ 'others': [
+ { 'path': 'std', 'name': 'reference' },
+ ],
+};
diff --git a/tests/rustdoc-js-std/alias-2.js b/tests/rustdoc-js-std/alias-2.js
new file mode 100644
index 000000000..798fa29ef
--- /dev/null
+++ b/tests/rustdoc-js-std/alias-2.js
@@ -0,0 +1,10 @@
+const QUERY = '+';
+
+const EXPECTED = {
+ 'others': [
+ { 'path': 'std::ops', 'name': 'AddAssign' },
+ { 'path': 'std::ops', 'name': 'Add' },
+ { 'path': 'core::ops', 'name': 'AddAssign' },
+ { 'path': 'core::ops', 'name': 'Add' },
+ ],
+};
diff --git a/tests/rustdoc-js-std/alias-3.js b/tests/rustdoc-js-std/alias-3.js
new file mode 100644
index 000000000..392b1e818
--- /dev/null
+++ b/tests/rustdoc-js-std/alias-3.js
@@ -0,0 +1,7 @@
+const QUERY = '!';
+
+const EXPECTED = {
+ 'others': [
+ { 'path': 'std', 'name': 'never' },
+ ],
+};
diff --git a/tests/rustdoc-js-std/alias-4.js b/tests/rustdoc-js-std/alias-4.js
new file mode 100644
index 000000000..bf2bb4d29
--- /dev/null
+++ b/tests/rustdoc-js-std/alias-4.js
@@ -0,0 +1,7 @@
+const QUERY = '<';
+
+const EXPECTED = {
+ 'others': [
+ { 'name': 'Ord' },
+ ],
+};
diff --git a/tests/rustdoc-js-std/alias.js b/tests/rustdoc-js-std/alias.js
new file mode 100644
index 000000000..2b709c991
--- /dev/null
+++ b/tests/rustdoc-js-std/alias.js
@@ -0,0 +1,11 @@
+// ignore-order
+
+const QUERY = '[';
+
+const EXPECTED = {
+ 'others': [
+ { 'path': 'std', 'name': 'slice' },
+ { 'path': 'std::ops', 'name': 'IndexMut' },
+ { 'path': 'std::ops', 'name': 'Index' },
+ ],
+};
diff --git a/tests/rustdoc-js-std/asrawfd.js b/tests/rustdoc-js-std/asrawfd.js
new file mode 100644
index 000000000..369a34f9c
--- /dev/null
+++ b/tests/rustdoc-js-std/asrawfd.js
@@ -0,0 +1,14 @@
+// ignore-order
+
+const QUERY = 'RawFd::as_raw_fd';
+
+const EXPECTED = {
+ 'others': [
+ // Reproduction test for https://github.com/rust-lang/rust/issues/78724
+ // Validate that type alias methods get the correct path.
+ { 'path': 'std::os::fd::AsRawFd', 'name': 'as_raw_fd' },
+ { 'path': 'std::os::fd::AsRawFd', 'name': 'as_raw_fd' },
+ { 'path': 'std::os::linux::process::PidFd', 'name': 'as_raw_fd' },
+ { 'path': 'std::os::fd::RawFd', 'name': 'as_raw_fd' },
+ ],
+};
diff --git a/tests/rustdoc-js-std/basic.js b/tests/rustdoc-js-std/basic.js
new file mode 100644
index 000000000..824cac710
--- /dev/null
+++ b/tests/rustdoc-js-std/basic.js
@@ -0,0 +1,15 @@
+const QUERY = 'String';
+
+const EXPECTED = {
+ 'others': [
+ { 'path': 'std::string', 'name': 'String' },
+ { 'path': 'std::ffi', 'name': 'CString' },
+ { 'path': 'std::ffi', 'name': 'OsString' },
+ ],
+ 'in_args': [
+ { 'path': 'std::str', 'name': 'eq' },
+ ],
+ 'returned': [
+ { 'path': 'std::string::String', 'name': 'add' },
+ ],
+};
diff --git a/tests/rustdoc-js-std/deduplication.js b/tests/rustdoc-js-std/deduplication.js
new file mode 100644
index 000000000..f02f6cf55
--- /dev/null
+++ b/tests/rustdoc-js-std/deduplication.js
@@ -0,0 +1,11 @@
+// ignore-order
+
+const QUERY = 'is_nan';
+
+const EXPECTED = {
+ 'others': [
+ { 'path': 'std::f32', 'name': 'is_nan' },
+ { 'path': 'std::f64', 'name': 'is_nan' },
+ { 'path': 'std::option::Option', 'name': 'is_none' },
+ ],
+};
diff --git a/tests/rustdoc-js-std/enum-option.js b/tests/rustdoc-js-std/enum-option.js
new file mode 100644
index 000000000..902e09069
--- /dev/null
+++ b/tests/rustdoc-js-std/enum-option.js
@@ -0,0 +1,7 @@
+const QUERY = 'enum:Option';
+
+const EXPECTED = {
+ 'others': [
+ { 'path': 'std::option', 'name': 'Option' },
+ ],
+};
diff --git a/tests/rustdoc-js-std/filter-crate.js b/tests/rustdoc-js-std/filter-crate.js
new file mode 100644
index 000000000..b47a1fefa
--- /dev/null
+++ b/tests/rustdoc-js-std/filter-crate.js
@@ -0,0 +1,9 @@
+// exact-check
+
+const QUERY = '"hashmap"';
+const FILTER_CRATE = 'core';
+
+const EXPECTED = {
+ 'others': [
+ ],
+};
diff --git a/tests/rustdoc-js-std/fn-forget.js b/tests/rustdoc-js-std/fn-forget.js
new file mode 100644
index 000000000..66a5fcaa7
--- /dev/null
+++ b/tests/rustdoc-js-std/fn-forget.js
@@ -0,0 +1,8 @@
+const QUERY = 'fn:forget';
+
+const EXPECTED = {
+ '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
new file mode 100644
index 000000000..e3f3cd436
--- /dev/null
+++ b/tests/rustdoc-js-std/from_u.js
@@ -0,0 +1,9 @@
+const QUERY = 'from_u';
+
+const EXPECTED = {
+ 'others': [
+ { 'path': 'std::char', 'name': 'from_u32' },
+ { 'path': 'std::str', 'name': 'from_utf8' },
+ { 'path': 'std::string::String', 'name': 'from_utf8' },
+ ],
+};
diff --git a/tests/rustdoc-js-std/keyword.js b/tests/rustdoc-js-std/keyword.js
new file mode 100644
index 000000000..868ddd7b6
--- /dev/null
+++ b/tests/rustdoc-js-std/keyword.js
@@ -0,0 +1,10 @@
+// ignore-order
+
+const QUERY = 'fn';
+
+const EXPECTED = {
+ '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
new file mode 100644
index 000000000..242e0cbf5
--- /dev/null
+++ b/tests/rustdoc-js-std/macro-check.js
@@ -0,0 +1,10 @@
+// ignore-order
+
+const QUERY = 'panic';
+
+const EXPECTED = {
+ '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
new file mode 100644
index 000000000..1b4c7b405
--- /dev/null
+++ b/tests/rustdoc-js-std/macro-print.js
@@ -0,0 +1,10 @@
+const QUERY = 'macro:print';
+
+const EXPECTED = {
+ 'others': [
+ { 'path': 'std', 'name': 'print' },
+ { 'path': 'std', 'name': 'println' },
+ { 'path': 'std', 'name': 'eprint' },
+ { 'path': 'std', 'name': 'eprintln' },
+ ],
+};
diff --git a/tests/rustdoc-js-std/never.js b/tests/rustdoc-js-std/never.js
new file mode 100644
index 000000000..392b1e818
--- /dev/null
+++ b/tests/rustdoc-js-std/never.js
@@ -0,0 +1,7 @@
+const QUERY = '!';
+
+const EXPECTED = {
+ 'others': [
+ { 'path': 'std', 'name': 'never' },
+ ],
+};
diff --git a/tests/rustdoc-js-std/parser-errors.js b/tests/rustdoc-js-std/parser-errors.js
new file mode 100644
index 000000000..dc42031e0
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-errors.js
@@ -0,0 +1,385 @@
+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 = [
+ {
+ elems: [],
+ foundElems: 0,
+ original: "<P>",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "<p>",
+ error: "Found generics without a path",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "-> <P>",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "-> <p>",
+ error: "Found generics without a path",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "a<\"P\">",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a<\"p\">",
+ error: "`\"` cannot be used in generics",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "\"P\" \"P\"",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "\"p\" \"p\"",
+ error: "Cannot have more than one literal search element",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "P \"P\"",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "p \"p\"",
+ error: "Cannot use literal search when there is more than one element",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "\"p\" p",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "\"p\" p",
+ error: "You cannot have more than one element if you use quotes",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "\"const\": p",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "\"const\": p",
+ error: "You cannot use quotes on type filter",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "a<:a>",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a<:a>",
+ error: "Unexpected `:` after `<`",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "a<::a>",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a<::a>",
+ error: "Unexpected `::`: paths cannot start with `::`",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "((a))",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "((a))",
+ error: "Unexpected `(`",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "(p -> p",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "(p -> p",
+ error: "Unexpected `(`",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "::a::b",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "::a::b",
+ error: "Paths cannot start with `::`",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "a::::b",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a::::b",
+ error: "Unexpected `::::`",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "a::b::",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a::b::",
+ error: "Paths cannot end with `::`",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: ":a",
+ returned: [],
+ typeFilter: -1,
+ userQuery: ":a",
+ error: "Expected type filter before `:`",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "a b:",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a b:",
+ error: "Unexpected `:`",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "a (b:",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a (b:",
+ error: "Unexpected `(`",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "_:",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "_:",
+ error: "Unknown type filter `_`",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "a-bb",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a-bb",
+ error: "Unexpected `-` (did you mean `->`?)",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "a>bb",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a>bb",
+ error: "Unexpected `>` (did you mean `->`?)",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "ab'",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "ab'",
+ error: "Unexpected `'`",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "a->",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a->",
+ error: "Expected at least one item after `->`",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: '"p" <a>',
+ returned: [],
+ typeFilter: -1,
+ userQuery: '"p" <a>',
+ error: "Found generics without a path",
+ },
+ {
+ 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",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: 'a,<',
+ returned: [],
+ typeFilter: -1,
+ userQuery: 'a,<',
+ error: 'Found generics without a path',
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: 'aaaaa<>b',
+ returned: [],
+ typeFilter: -1,
+ userQuery: 'aaaaa<>b',
+ error: 'Expected `,`, ` `, `:` or `->`, found `b`',
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: 'fn:aaaaa<>b',
+ returned: [],
+ typeFilter: -1,
+ userQuery: 'fn:aaaaa<>b',
+ error: 'Expected `,`, ` ` or `->`, found `b`',
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: '->a<>b',
+ returned: [],
+ typeFilter: -1,
+ userQuery: '->a<>b',
+ error: 'Expected `,` or ` `, found `b`',
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: 'a<->',
+ returned: [],
+ typeFilter: -1,
+ userQuery: 'a<->',
+ error: 'Unexpected `-` after `<`',
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: 'a:: a',
+ returned: [],
+ typeFilter: -1,
+ userQuery: 'a:: a',
+ error: 'Paths cannot end with `::`',
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: 'a ::a',
+ returned: [],
+ typeFilter: -1,
+ userQuery: 'a ::a',
+ error: 'Paths cannot start with `::`',
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "a<a>:",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a<a>:",
+ error: 'Unexpected `:`',
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "a<>:",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a<>:",
+ error: 'Unexpected `<` in type filter',
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "a,:",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a,:",
+ error: 'Unexpected `,` in type filter',
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "a<> :",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a<> :",
+ error: 'Unexpected `<` in type filter',
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "mod : :",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "mod : :",
+ error: 'Unexpected `:`',
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "a!a",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a!a",
+ error: '`!` can only be at the end of an ident',
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "a!!",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a!!",
+ error: 'Cannot have more than one `!` in an ident',
+ },
+];
diff --git a/tests/rustdoc-js-std/parser-filter.js b/tests/rustdoc-js-std/parser-filter.js
new file mode 100644
index 000000000..e5a87a415
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-filter.js
@@ -0,0 +1,43 @@
+const QUERY = ['fn:foo', 'enum : foo', 'macro<f>:foo'];
+
+const PARSED = [
+ {
+ elems: [{
+ name: "foo",
+ fullPath: ["foo"],
+ pathWithoutLast: [],
+ pathLast: "foo",
+ generics: [],
+ }],
+ foundElems: 1,
+ original: "fn:foo",
+ returned: [],
+ typeFilter: 5,
+ userQuery: "fn:foo",
+ error: null,
+ },
+ {
+ elems: [{
+ name: "foo",
+ fullPath: ["foo"],
+ pathWithoutLast: [],
+ pathLast: "foo",
+ generics: [],
+ }],
+ foundElems: 1,
+ original: "enum : foo",
+ returned: [],
+ typeFilter: 4,
+ userQuery: "enum : foo",
+ error: null,
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "macro<f>:foo",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "macro<f>:foo",
+ error: "Unexpected `:`",
+ },
+];
diff --git a/tests/rustdoc-js-std/parser-generics.js b/tests/rustdoc-js-std/parser-generics.js
new file mode 100644
index 000000000..0cf7f5019
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-generics.js
@@ -0,0 +1,62 @@
+const QUERY = ['A<B<C<D>, E>', 'p<> u8', '"p"<a>'];
+
+const PARSED = [
+ {
+ elems: [],
+ foundElems: 0,
+ original: 'A<B<C<D>, E>',
+ returned: [],
+ typeFilter: -1,
+ userQuery: 'a<b<c<d>, e>',
+ error: 'Unexpected `<` after `<`',
+ },
+ {
+ elems: [
+ {
+ name: "p",
+ fullPath: ["p"],
+ pathWithoutLast: [],
+ pathLast: "p",
+ generics: [],
+ },
+ {
+ name: "u8",
+ fullPath: ["u8"],
+ pathWithoutLast: [],
+ pathLast: "u8",
+ generics: [],
+ },
+ ],
+ foundElems: 2,
+ original: "p<> u8",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "p<> u8",
+ error: null,
+ },
+ {
+ elems: [
+ {
+ name: "p",
+ fullPath: ["p"],
+ pathWithoutLast: [],
+ pathLast: "p",
+ generics: [
+ {
+ name: "a",
+ fullPath: ["a"],
+ pathWithoutLast: [],
+ pathLast: "a",
+ generics: [],
+ },
+ ],
+ },
+ ],
+ foundElems: 1,
+ original: '"p"<a>',
+ returned: [],
+ typeFilter: -1,
+ userQuery: '"p"<a>',
+ error: null,
+ },
+];
diff --git a/tests/rustdoc-js-std/parser-ident.js b/tests/rustdoc-js-std/parser-ident.js
new file mode 100644
index 000000000..4b5ab01ac
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-ident.js
@@ -0,0 +1,93 @@
+const QUERY = [
+ "R<!>",
+ "!",
+ "a!",
+ "a!::b",
+ "a!::b!",
+];
+
+const PARSED = [
+ {
+ elems: [{
+ name: "r",
+ fullPath: ["r"],
+ pathWithoutLast: [],
+ pathLast: "r",
+ generics: [
+ {
+ name: "!",
+ fullPath: ["!"],
+ pathWithoutLast: [],
+ pathLast: "!",
+ generics: [],
+ },
+ ],
+ }],
+ foundElems: 1,
+ original: "R<!>",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "r<!>",
+ error: null,
+ },
+ {
+ elems: [{
+ name: "!",
+ fullPath: ["!"],
+ pathWithoutLast: [],
+ pathLast: "!",
+ generics: [],
+ }],
+ foundElems: 1,
+ original: "!",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "!",
+ error: null,
+ },
+ {
+ elems: [{
+ name: "a!",
+ fullPath: ["a!"],
+ pathWithoutLast: [],
+ pathLast: "a!",
+ generics: [],
+ }],
+ foundElems: 1,
+ original: "a!",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a!",
+ error: null,
+ },
+ {
+ elems: [{
+ name: "a!::b",
+ fullPath: ["a!", "b"],
+ pathWithoutLast: ["a!"],
+ pathLast: "b",
+ generics: [],
+ }],
+ foundElems: 1,
+ original: "a!::b",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a!::b",
+ error: null,
+ },
+ {
+ elems: [{
+ name: "a!::b!",
+ fullPath: ["a!", "b!"],
+ pathWithoutLast: ["a!"],
+ pathLast: "b!",
+ generics: [],
+ }],
+ foundElems: 1,
+ original: "a!::b!",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a!::b!",
+ error: null,
+ },
+];
diff --git a/tests/rustdoc-js-std/parser-literal.js b/tests/rustdoc-js-std/parser-literal.js
new file mode 100644
index 000000000..87b3baff1
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-literal.js
@@ -0,0 +1,27 @@
+const QUERY = ['R<P>'];
+
+const PARSED = [
+ {
+ elems: [{
+ name: "r",
+ fullPath: ["r"],
+ pathWithoutLast: [],
+ pathLast: "r",
+ generics: [
+ {
+ name: "p",
+ fullPath: ["p"],
+ pathWithoutLast: [],
+ pathLast: "p",
+ generics: [],
+ },
+ ],
+ }],
+ foundElems: 1,
+ original: "R<P>",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "r<p>",
+ error: null,
+ }
+];
diff --git a/tests/rustdoc-js-std/parser-paths.js b/tests/rustdoc-js-std/parser-paths.js
new file mode 100644
index 000000000..9f823f933
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-paths.js
@@ -0,0 +1,90 @@
+const QUERY = ['A::B', 'A::B,C', 'A::B<f>,C', 'mod::a'];
+
+const PARSED = [
+ {
+ elems: [{
+ name: "a::b",
+ fullPath: ["a", "b"],
+ pathWithoutLast: ["a"],
+ pathLast: "b",
+ generics: [],
+ }],
+ foundElems: 1,
+ original: "A::B",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a::b",
+ error: null,
+ },
+ {
+ elems: [
+ {
+ name: "a::b",
+ fullPath: ["a", "b"],
+ pathWithoutLast: ["a"],
+ pathLast: "b",
+ generics: [],
+ },
+ {
+ name: "c",
+ fullPath: ["c"],
+ pathWithoutLast: [],
+ pathLast: "c",
+ generics: [],
+ },
+ ],
+ foundElems: 2,
+ original: 'A::B,C',
+ returned: [],
+ typeFilter: -1,
+ userQuery: 'a::b,c',
+ error: null,
+ },
+ {
+ elems: [
+ {
+ name: "a::b",
+ fullPath: ["a", "b"],
+ pathWithoutLast: ["a"],
+ pathLast: "b",
+ generics: [
+ {
+ name: "f",
+ fullPath: ["f"],
+ pathWithoutLast: [],
+ pathLast: "f",
+ generics: [],
+ },
+ ],
+ },
+ {
+ name: "c",
+ fullPath: ["c"],
+ pathWithoutLast: [],
+ pathLast: "c",
+ generics: [],
+ },
+ ],
+ foundElems: 2,
+ original: 'A::B<f>,C',
+ returned: [],
+ typeFilter: -1,
+ userQuery: 'a::b<f>,c',
+ error: null,
+ },
+ {
+ elems: [{
+ name: "mod::a",
+ fullPath: ["mod", "a"],
+ pathWithoutLast: ["mod"],
+ pathLast: "a",
+ generics: [],
+ }],
+ foundElems: 1,
+ original: "mod::a",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "mod::a",
+ error: null,
+ },
+];
diff --git a/tests/rustdoc-js-std/parser-quote.js b/tests/rustdoc-js-std/parser-quote.js
new file mode 100644
index 000000000..1e16c90de
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-quote.js
@@ -0,0 +1,87 @@
+const QUERY = [
+ '-> "p"',
+ '"p",',
+ '"p" -> a',
+ '"a" -> "p"',
+ '->"-"',
+ '"a',
+ '""',
+];
+
+const PARSED = [
+ {
+ elems: [],
+ foundElems: 1,
+ original: '-> "p"',
+ returned: [{
+ name: "p",
+ fullPath: ["p"],
+ pathWithoutLast: [],
+ pathLast: "p",
+ generics: [],
+ }],
+ typeFilter: -1,
+ userQuery: '-> "p"',
+ error: null,
+ },
+ {
+ elems: [{
+ name: "p",
+ fullPath: ["p"],
+ pathWithoutLast: [],
+ pathLast: "p",
+ generics: [],
+ }],
+ foundElems: 1,
+ original: '"p",',
+ returned: [],
+ typeFilter: -1,
+ userQuery: '"p",',
+ error: null,
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: '"p" -> a',
+ returned: [],
+ typeFilter: -1,
+ userQuery: '"p" -> a',
+ error: "You cannot have more than one element if you use quotes",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: '"a" -> "p"',
+ returned: [],
+ typeFilter: -1,
+ userQuery: '"a" -> "p"',
+ error: "Cannot have more than one literal search element",
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: '->"-"',
+ returned: [],
+ typeFilter: -1,
+ userQuery: '->"-"',
+ error: 'Unexpected `-` in a string element',
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: '"a',
+ returned: [],
+ typeFilter: -1,
+ userQuery: '"a',
+ error: 'Unclosed `"`',
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: '""',
+ returned: [],
+ typeFilter: -1,
+ userQuery: '""',
+ error: 'Cannot have empty string element',
+ },
+];
diff --git a/tests/rustdoc-js-std/parser-returned.js b/tests/rustdoc-js-std/parser-returned.js
new file mode 100644
index 000000000..6fce17dca
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-returned.js
@@ -0,0 +1,99 @@
+const QUERY = [
+ "-> F<P>",
+ "-> P",
+ "->,a",
+ "aaaaa->a",
+ "-> !",
+];
+
+const PARSED = [
+ {
+ elems: [],
+ foundElems: 1,
+ original: "-> F<P>",
+ returned: [{
+ name: "f",
+ fullPath: ["f"],
+ pathWithoutLast: [],
+ pathLast: "f",
+ generics: [
+ {
+ name: "p",
+ fullPath: ["p"],
+ pathWithoutLast: [],
+ pathLast: "p",
+ generics: [],
+ },
+ ],
+ }],
+ typeFilter: -1,
+ userQuery: "-> f<p>",
+ error: null,
+ },
+ {
+ elems: [],
+ foundElems: 1,
+ original: "-> P",
+ returned: [{
+ name: "p",
+ fullPath: ["p"],
+ pathWithoutLast: [],
+ pathLast: "p",
+ generics: [],
+ }],
+ typeFilter: -1,
+ userQuery: "-> p",
+ error: null,
+ },
+ {
+ elems: [],
+ foundElems: 1,
+ original: "->,a",
+ returned: [{
+ name: "a",
+ fullPath: ["a"],
+ pathWithoutLast: [],
+ pathLast: "a",
+ generics: [],
+ }],
+ typeFilter: -1,
+ userQuery: "->,a",
+ error: null,
+ },
+ {
+ elems: [{
+ name: "aaaaa",
+ fullPath: ["aaaaa"],
+ pathWithoutLast: [],
+ pathLast: "aaaaa",
+ generics: [],
+ }],
+ foundElems: 2,
+ original: "aaaaa->a",
+ returned: [{
+ name: "a",
+ fullPath: ["a"],
+ pathWithoutLast: [],
+ pathLast: "a",
+ generics: [],
+ }],
+ typeFilter: -1,
+ userQuery: "aaaaa->a",
+ error: null,
+ },
+ {
+ elems: [],
+ foundElems: 1,
+ original: "-> !",
+ returned: [{
+ name: "!",
+ fullPath: ["!"],
+ pathWithoutLast: [],
+ pathLast: "!",
+ generics: [],
+ }],
+ typeFilter: -1,
+ userQuery: "-> !",
+ error: null,
+ },
+];
diff --git a/tests/rustdoc-js-std/parser-separators.js b/tests/rustdoc-js-std/parser-separators.js
new file mode 100644
index 000000000..5b7abdfa8
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-separators.js
@@ -0,0 +1,206 @@
+// ignore-tidy-tab
+
+const QUERY = [
+ 'aaaaaa b',
+ 'a b',
+ 'a,b',
+ 'a\tb',
+ 'a<b c>',
+ 'a<b,c>',
+ 'a<b\tc>',
+];
+
+const PARSED = [
+ {
+ elems: [
+ {
+ name: 'aaaaaa',
+ fullPath: ['aaaaaa'],
+ pathWithoutLast: [],
+ pathLast: 'aaaaaa',
+ generics: [],
+ },
+ {
+ name: 'b',
+ fullPath: ['b'],
+ pathWithoutLast: [],
+ pathLast: 'b',
+ generics: [],
+ },
+ ],
+ foundElems: 2,
+ original: "aaaaaa b",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "aaaaaa b",
+ error: null,
+ },
+ {
+ elems: [
+ {
+ name: 'a',
+ fullPath: ['a'],
+ pathWithoutLast: [],
+ pathLast: 'a',
+ generics: [],
+ },
+ {
+ name: 'b',
+ fullPath: ['b'],
+ pathWithoutLast: [],
+ pathLast: 'b',
+ generics: [],
+ },
+ ],
+ foundElems: 2,
+ original: "a b",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a b",
+ error: null,
+ },
+ {
+ elems: [
+ {
+ name: 'a',
+ fullPath: ['a'],
+ pathWithoutLast: [],
+ pathLast: 'a',
+ generics: [],
+ },
+ {
+ name: 'b',
+ fullPath: ['b'],
+ pathWithoutLast: [],
+ pathLast: 'b',
+ generics: [],
+ },
+ ],
+ foundElems: 2,
+ original: "a,b",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a,b",
+ error: null,
+ },
+ {
+ elems: [
+ {
+ name: 'a',
+ fullPath: ['a'],
+ pathWithoutLast: [],
+ pathLast: 'a',
+ generics: [],
+ },
+ {
+ name: 'b',
+ fullPath: ['b'],
+ pathWithoutLast: [],
+ pathLast: 'b',
+ generics: [],
+ },
+ ],
+ foundElems: 2,
+ original: "a\tb",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a\tb",
+ error: null,
+ },
+ {
+ elems: [
+ {
+ name: 'a',
+ fullPath: ['a'],
+ pathWithoutLast: [],
+ pathLast: 'a',
+ generics: [
+ {
+ name: 'b',
+ fullPath: ['b'],
+ pathWithoutLast: [],
+ pathLast: 'b',
+ generics: [],
+ },
+ {
+ name: 'c',
+ fullPath: ['c'],
+ pathWithoutLast: [],
+ pathLast: 'c',
+ generics: [],
+ },
+ ],
+ },
+ ],
+ foundElems: 1,
+ original: "a<b c>",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a<b c>",
+ error: null,
+ },
+ {
+ elems: [
+ {
+ name: 'a',
+ fullPath: ['a'],
+ pathWithoutLast: [],
+ pathLast: 'a',
+ generics: [
+ {
+ name: 'b',
+ fullPath: ['b'],
+ pathWithoutLast: [],
+ pathLast: 'b',
+ generics: [],
+ },
+ {
+ name: 'c',
+ fullPath: ['c'],
+ pathWithoutLast: [],
+ pathLast: 'c',
+ generics: [],
+ },
+ ],
+ },
+ ],
+ foundElems: 1,
+ original: "a<b,c>",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a<b,c>",
+ error: null,
+ },
+ {
+ elems: [
+ {
+ name: 'a',
+ fullPath: ['a'],
+ pathWithoutLast: [],
+ pathLast: 'a',
+ generics: [
+ {
+ name: 'b',
+ fullPath: ['b'],
+ pathWithoutLast: [],
+ pathLast: 'b',
+ generics: [],
+ },
+ {
+ name: 'c',
+ fullPath: ['c'],
+ pathWithoutLast: [],
+ pathLast: 'c',
+ generics: [],
+ },
+ ],
+ },
+ ],
+ foundElems: 1,
+ original: "a<b\tc>",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a<b\tc>",
+ error: null,
+ },
+];
diff --git a/tests/rustdoc-js-std/parser-weird-queries.js b/tests/rustdoc-js-std/parser-weird-queries.js
new file mode 100644
index 000000000..a3d85aeca
--- /dev/null
+++ b/tests/rustdoc-js-std/parser-weird-queries.js
@@ -0,0 +1,123 @@
+// 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 = [
+ {
+ elems: [
+ {
+ name: "a",
+ fullPath: ["a"],
+ pathWithoutLast: [],
+ pathLast: "a",
+ generics: [],
+ },
+ {
+ name: "b",
+ fullPath: ["b"],
+ pathWithoutLast: [],
+ pathLast: "b",
+ generics: [],
+ },
+ ],
+ foundElems: 2,
+ original: "a b",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a b",
+ error: null,
+ },
+ {
+ elems: [
+ {
+ name: "a",
+ fullPath: ["a"],
+ pathWithoutLast: [],
+ pathLast: "a",
+ generics: [],
+ },
+ {
+ name: "b",
+ fullPath: ["b"],
+ pathWithoutLast: [],
+ pathLast: "b",
+ generics: [],
+ },
+ ],
+ foundElems: 2,
+ original: "a b",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a b",
+ error: null,
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "a,b(c)",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a,b(c)",
+ error: "Unexpected `(`",
+ },
+ {
+ elems: [
+ {
+ name: "aaa",
+ fullPath: ["aaa"],
+ pathWithoutLast: [],
+ pathLast: "aaa",
+ generics: [],
+ },
+ {
+ name: "a",
+ fullPath: ["a"],
+ pathWithoutLast: [],
+ pathLast: "a",
+ generics: [],
+ },
+ ],
+ foundElems: 2,
+ original: "aaa,a",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "aaa,a",
+ error: null,
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: ",,,,",
+ returned: [],
+ typeFilter: -1,
+ userQuery: ",,,,",
+ error: null,
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: 'mod :',
+ returned: [],
+ typeFilter: 0,
+ userQuery: 'mod :',
+ error: null,
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: 'mod\t:',
+ returned: [],
+ typeFilter: 0,
+ userQuery: 'mod\t:',
+ error: null,
+ },
+];
diff --git a/tests/rustdoc-js-std/path-ordering.js b/tests/rustdoc-js-std/path-ordering.js
new file mode 100644
index 000000000..7dcdd4023
--- /dev/null
+++ b/tests/rustdoc-js-std/path-ordering.js
@@ -0,0 +1,12 @@
+const QUERY = 'hashset::insert';
+
+const EXPECTED = {
+ 'others': [
+ // ensure hashset::insert comes first
+ { 'path': 'std::collections::hash_set::HashSet', 'name': 'insert' },
+ { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert' },
+ { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_with' },
+ { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_owned' },
+ { 'path': 'std::collections::hash_map::HashMap', 'name': 'insert' },
+ ],
+};
diff --git a/tests/rustdoc-js-std/primitive.js b/tests/rustdoc-js-std/primitive.js
new file mode 100644
index 000000000..e5690383e
--- /dev/null
+++ b/tests/rustdoc-js-std/primitive.js
@@ -0,0 +1,75 @@
+const QUERY = [
+ 'i8',
+ 'u32',
+ 'str',
+ 'char',
+ 'unit',
+ 'tuple',
+ 'fn',
+];
+
+const EXPECTED = [
+ {
+ 'others': [
+ {
+ 'path': 'std',
+ 'name': 'i8',
+ 'href': '../std/primitive.i8.html',
+ },
+ ]
+ },
+ {
+ 'others': [
+ {
+ 'path': 'std',
+ 'name': 'u32',
+ 'href': '../std/primitive.u32.html',
+ },
+ ]
+ },
+ {
+ 'others': [
+ {
+ 'path': 'std',
+ 'name': 'str',
+ 'href': '../std/primitive.str.html',
+ },
+ ]
+ },
+ {
+ 'others': [
+ {
+ 'path': 'std',
+ 'name': 'char',
+ 'href': '../std/primitive.char.html',
+ },
+ ]
+ },
+ {
+ 'others': [
+ {
+ 'path': 'std',
+ 'name': 'unit',
+ 'href': '../std/primitive.unit.html',
+ },
+ ]
+ },
+ {
+ 'others': [
+ {
+ 'path': 'std',
+ 'name': 'tuple',
+ 'href': '../std/primitive.tuple.html',
+ },
+ ]
+ },
+ {
+ 'others': [
+ {
+ 'path': 'std',
+ 'name': 'fn',
+ 'href': '../std/primitive.fn.html',
+ },
+ ]
+ },
+];
diff --git a/tests/rustdoc-js-std/quoted.js b/tests/rustdoc-js-std/quoted.js
new file mode 100644
index 000000000..aec8484a4
--- /dev/null
+++ b/tests/rustdoc-js-std/quoted.js
@@ -0,0 +1,21 @@
+// ignore-order
+
+const QUERY = '"error"';
+const FILTER_CRATE = 'std';
+
+const EXPECTED = {
+ 'others': [
+ { 'path': 'std', 'name': 'error' },
+ { 'path': 'std::fmt', 'name': 'Error' },
+ { 'path': 'std::io', 'name': 'Error' },
+ ],
+ 'in_args': [
+ { 'path': 'std::fmt::Error', 'name': 'eq' },
+ { 'path': 'std::fmt::Error', 'name': 'cmp' },
+ { 'path': 'std::fmt::Error', 'name': 'partial_cmp' },
+
+ ],
+ 'returned': [
+ { 'path': 'std::fmt::LowerExp', 'name': 'fmt' },
+ ],
+};
diff --git a/tests/rustdoc-js-std/return-specific-literal.js b/tests/rustdoc-js-std/return-specific-literal.js
new file mode 100644
index 000000000..c7c347240
--- /dev/null
+++ b/tests/rustdoc-js-std/return-specific-literal.js
@@ -0,0 +1,10 @@
+const QUERY = 'struct:"string"';
+
+const EXPECTED = {
+ 'in_args': [
+ { 'path': 'std::string::String', 'name': 'ne' },
+ ],
+ 'returned': [
+ { 'path': 'std::string::String', 'name': 'add' },
+ ],
+};
diff --git a/tests/rustdoc-js-std/return-specific.js b/tests/rustdoc-js-std/return-specific.js
new file mode 100644
index 000000000..d9a910553
--- /dev/null
+++ b/tests/rustdoc-js-std/return-specific.js
@@ -0,0 +1,10 @@
+const QUERY = 'struct:string';
+
+const EXPECTED = {
+ 'in_args': [
+ { 'path': 'std::string::String', 'name': 'ne' },
+ ],
+ 'returned': [
+ { 'path': 'std::string::String', 'name': 'add' },
+ ],
+};
diff --git a/tests/rustdoc-js-std/should-fail.js b/tests/rustdoc-js-std/should-fail.js
new file mode 100644
index 000000000..b85a47dc0
--- /dev/null
+++ b/tests/rustdoc-js-std/should-fail.js
@@ -0,0 +1,9 @@
+// should-fail
+
+const QUERY = 'fn';
+
+const EXPECTED = {
+ '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
new file mode 100644
index 000000000..f9edf4408
--- /dev/null
+++ b/tests/rustdoc-js-std/string-from_ut.js
@@ -0,0 +1,11 @@
+const QUERY = 'String::from_ut';
+
+const EXPECTED = {
+ 'others': [
+ { 'path': 'std::string::String', 'name': 'from_utf8' },
+ { 'path': 'std::string::String', 'name': 'from_utf8' },
+ { 'path': 'std::string::String', 'name': 'from_utf8_lossy' },
+ { 'path': 'std::string::String', 'name': 'from_utf16_lossy' },
+ { 'path': 'std::string::String', 'name': 'from_utf8_unchecked' },
+ ],
+};
diff --git a/tests/rustdoc-js-std/struct-vec.js b/tests/rustdoc-js-std/struct-vec.js
new file mode 100644
index 000000000..29609904b
--- /dev/null
+++ b/tests/rustdoc-js-std/struct-vec.js
@@ -0,0 +1,8 @@
+const QUERY = 'struct:VecD';
+
+const EXPECTED = {
+ '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
new file mode 100644
index 000000000..fd5c5489d
--- /dev/null
+++ b/tests/rustdoc-js-std/typed-query.js
@@ -0,0 +1,17 @@
+// exact-check
+
+const QUERY = 'macro:print';
+const FILTER_CRATE = 'std';
+
+const EXPECTED = {
+ 'others': [
+ { 'path': 'std', 'name': 'print' },
+ { 'path': 'std', 'name': 'println' },
+ { 'path': 'std', 'name': 'eprint' },
+ { 'path': 'std', 'name': 'eprintln' },
+ { 'path': 'std::pin', 'name': 'pin' },
+ { 'path': 'std::future', 'name': 'join' },
+ { 'path': 'std', 'name': 'line' },
+ { 'path': 'std', 'name': 'write' },
+ ],
+};
diff --git a/tests/rustdoc-js-std/vec-new.js b/tests/rustdoc-js-std/vec-new.js
new file mode 100644
index 000000000..fc44a566a
--- /dev/null
+++ b/tests/rustdoc-js-std/vec-new.js
@@ -0,0 +1,10 @@
+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' },
+ ],
+};