summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc-js-std
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/rustdoc-js-std/parser-errors.js34
-rw-r--r--tests/rustdoc-js-std/parser-filter.js47
-rw-r--r--tests/rustdoc-js-std/parser-ident.js40
-rw-r--r--tests/rustdoc-js-std/reference-shrink.js8
-rw-r--r--tests/rustdoc-js-std/regex.js10
-rw-r--r--tests/rustdoc-js-std/typed-query.js4
6 files changed, 118 insertions, 25 deletions
diff --git a/tests/rustdoc-js-std/parser-errors.js b/tests/rustdoc-js-std/parser-errors.js
index dc42031e0..98c6f27ca 100644
--- a/tests/rustdoc-js-std/parser-errors.js
+++ b/tests/rustdoc-js-std/parser-errors.js
@@ -37,6 +37,9 @@ const QUERY = [
"mod : :",
"a!a",
"a!!",
+ "mod:a!",
+ "a!::a",
+ "a<",
];
const PARSED = [
@@ -65,7 +68,7 @@ const PARSED = [
returned: [],
typeFilter: -1,
userQuery: "a<\"p\">",
- error: "`\"` cannot be used in generics",
+ error: "Unexpected `\"` in generics",
},
{
elems: [],
@@ -371,7 +374,7 @@ const PARSED = [
returned: [],
typeFilter: -1,
userQuery: "a!a",
- error: '`!` can only be at the end of an ident',
+ error: 'Unexpected `!`: it can only be at the end of an ident',
},
{
elems: [],
@@ -382,4 +385,31 @@ const PARSED = [
userQuery: "a!!",
error: 'Cannot have more than one `!` in an ident',
},
+ {
+ elems: [],
+ foundElems: 0,
+ original: "mod:a!",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "mod:a!",
+ error: 'Invalid search type: macro `!` and `mod` both specified',
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "a!::a",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a!::a",
+ error: 'Cannot have associated items in macros',
+ },
+ {
+ elems: [],
+ foundElems: 0,
+ original: "a<",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "a<",
+ error: "Unclosed `<`",
+ },
];
diff --git a/tests/rustdoc-js-std/parser-filter.js b/tests/rustdoc-js-std/parser-filter.js
index e5a87a415..01f65b478 100644
--- a/tests/rustdoc-js-std/parser-filter.js
+++ b/tests/rustdoc-js-std/parser-filter.js
@@ -1,4 +1,4 @@
-const QUERY = ['fn:foo', 'enum : foo', 'macro<f>:foo'];
+const QUERY = ['fn:foo', 'enum : foo', 'macro<f>:foo', 'macro!', 'macro:mac!', 'a::mac!'];
const PARSED = [
{
@@ -40,4 +40,49 @@ const PARSED = [
userQuery: "macro<f>:foo",
error: "Unexpected `:`",
},
+ {
+ elems: [{
+ name: "macro",
+ fullPath: ["macro"],
+ pathWithoutLast: [],
+ pathLast: "macro",
+ generics: [],
+ }],
+ foundElems: 1,
+ original: "macro!",
+ returned: [],
+ typeFilter: 14,
+ userQuery: "macro!",
+ error: null,
+ },
+ {
+ elems: [{
+ name: "mac",
+ fullPath: ["mac"],
+ pathWithoutLast: [],
+ pathLast: "mac",
+ generics: [],
+ }],
+ foundElems: 1,
+ original: "macro:mac!",
+ returned: [],
+ typeFilter: 14,
+ userQuery: "macro:mac!",
+ error: null,
+ },
+ {
+ elems: [{
+ name: "a::mac",
+ fullPath: ["a", "mac"],
+ pathWithoutLast: ["a"],
+ pathLast: "mac",
+ generics: [],
+ }],
+ foundElems: 1,
+ original: "a::mac!",
+ returned: [],
+ typeFilter: 14,
+ userQuery: "a::mac!",
+ error: null,
+ },
];
diff --git a/tests/rustdoc-js-std/parser-ident.js b/tests/rustdoc-js-std/parser-ident.js
index 4b5ab01ac..6c17d00f1 100644
--- a/tests/rustdoc-js-std/parser-ident.js
+++ b/tests/rustdoc-js-std/parser-ident.js
@@ -3,6 +3,7 @@ const QUERY = [
"!",
"a!",
"a!::b",
+ "!::b",
"a!::b!",
];
@@ -47,47 +48,50 @@ const PARSED = [
},
{
elems: [{
- name: "a!",
- fullPath: ["a!"],
+ name: "a",
+ fullPath: ["a"],
pathWithoutLast: [],
- pathLast: "a!",
+ pathLast: "a",
generics: [],
}],
foundElems: 1,
original: "a!",
returned: [],
- typeFilter: -1,
+ typeFilter: 14,
userQuery: "a!",
error: null,
},
{
- elems: [{
- name: "a!::b",
- fullPath: ["a!", "b"],
- pathWithoutLast: ["a!"],
- pathLast: "b",
- generics: [],
- }],
- foundElems: 1,
+ elems: [],
+ foundElems: 0,
original: "a!::b",
returned: [],
typeFilter: -1,
userQuery: "a!::b",
- error: null,
+ error: "Cannot have associated items in macros",
},
{
elems: [{
- name: "a!::b!",
- fullPath: ["a!", "b!"],
- pathWithoutLast: ["a!"],
- pathLast: "b!",
+ name: "!::b",
+ fullPath: ["!", "b"],
+ pathWithoutLast: ["!"],
+ pathLast: "b",
generics: [],
}],
foundElems: 1,
+ original: "!::b",
+ returned: [],
+ typeFilter: -1,
+ userQuery: "!::b",
+ error: null,
+ },
+ {
+ elems: [],
+ foundElems: 0,
original: "a!::b!",
returned: [],
typeFilter: -1,
userQuery: "a!::b!",
- error: null,
+ error: "Cannot have associated items in macros",
},
];
diff --git a/tests/rustdoc-js-std/reference-shrink.js b/tests/rustdoc-js-std/reference-shrink.js
new file mode 100644
index 000000000..f90be6d1b
--- /dev/null
+++ b/tests/rustdoc-js-std/reference-shrink.js
@@ -0,0 +1,8 @@
+// exact-check
+
+const QUERY = 'reference::shrink';
+
+const EXPECTED = {
+ // 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
new file mode 100644
index 000000000..a6843c595
--- /dev/null
+++ b/tests/rustdoc-js-std/regex.js
@@ -0,0 +1,10 @@
+// exact-check
+
+// https://github.com/rust-lang/rust/issues/103357
+const QUERY = 'regex';
+
+const EXPECTED = {
+ 'others': [],
+ 'in_args': [],
+ 'returned': [],
+};
diff --git a/tests/rustdoc-js-std/typed-query.js b/tests/rustdoc-js-std/typed-query.js
index fd5c5489d..eeb3e1888 100644
--- a/tests/rustdoc-js-std/typed-query.js
+++ b/tests/rustdoc-js-std/typed-query.js
@@ -9,9 +9,5 @@ const EXPECTED = {
{ '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' },
],
};