2023-04-20 21:32:02 +00:00
|
|
|
// ignore-tidy-linelength
|
|
|
|
|
2023-04-15 18:53:50 +00:00
|
|
|
// Checks that the search tab result tell the user about corrections
|
|
|
|
// First, try a search-by-name
|
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
|
|
|
// Intentionally wrong spelling of "NotableStructWithLongName"
|
|
|
|
write: (".search-input", "NotableStructWithLongNamr")
|
|
|
|
// To be SURE that the search will be run.
|
|
|
|
press-key: 'Enter'
|
|
|
|
// Waiting for the search results to appear...
|
|
|
|
wait-for: "#search-tabs"
|
|
|
|
|
|
|
|
// Corrections aren't shown on the "In Names" tab.
|
|
|
|
assert: "#search-tabs button.selected:first-child"
|
|
|
|
assert-css: (".search-corrections", {
|
|
|
|
"display": "none"
|
|
|
|
})
|
|
|
|
|
|
|
|
// Corrections do get shown on the "In Parameters" tab.
|
|
|
|
click: "#search-tabs button:nth-child(2)"
|
|
|
|
assert: "#search-tabs button.selected:nth-child(2)"
|
|
|
|
assert-css: (".search-corrections", {
|
|
|
|
"display": "block"
|
|
|
|
})
|
|
|
|
assert-text: (
|
|
|
|
".search-corrections",
|
2023-04-20 21:32:02 +00:00
|
|
|
"Type \"notablestructwithlongnamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead."
|
2023-04-15 18:53:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Corrections do get shown on the "In Return Type" tab.
|
|
|
|
click: "#search-tabs button:nth-child(3)"
|
|
|
|
assert: "#search-tabs button.selected:nth-child(3)"
|
|
|
|
assert-css: (".search-corrections", {
|
|
|
|
"display": "block"
|
|
|
|
})
|
|
|
|
assert-text: (
|
|
|
|
".search-corrections",
|
2023-04-20 21:32:02 +00:00
|
|
|
"Type \"notablestructwithlongnamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead."
|
2023-04-15 18:53:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Now, explicit return values
|
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
|
|
|
// Intentionally wrong spelling of "NotableStructWithLongName"
|
|
|
|
write: (".search-input", "-> NotableStructWithLongNamr")
|
|
|
|
// To be SURE that the search will be run.
|
|
|
|
press-key: 'Enter'
|
|
|
|
// Waiting for the search results to appear...
|
|
|
|
wait-for: "#search-tabs"
|
|
|
|
|
|
|
|
assert-css: (".search-corrections", {
|
|
|
|
"display": "block"
|
|
|
|
})
|
|
|
|
assert-text: (
|
|
|
|
".search-corrections",
|
2023-04-20 21:32:02 +00:00
|
|
|
"Type \"notablestructwithlongnamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead."
|
2023-04-15 18:53:50 +00:00
|
|
|
)
|
rustdoc-search: add support for type parameters
When writing a type-driven search query in rustdoc, specifically one
with more than one query element, non-existent types become generic
parameters instead of auto-correcting (which is currently only done
for single-element queries) or giving no result. You can also force a
generic type parameter by writing `generic:T` (and can force it to not
use a generic type parameter with something like `struct:T` or whatever,
though if this happens it means the thing you're looking for doesn't
exist and will give you no results).
There is no syntax provided for specifying type constraints
for generic type parameters.
When you have a generic type parameter in a search query, it will only
match up with generic type parameters in the actual function, not
concrete types that match, not concrete types that implement a trait.
It also strictly matches based on when they're the same or different,
so `option<T>, option<U> -> option<U>` matches `Option::and`, but not
`Option::or`. Similarly, `option<T>, option<T> -> option<T>`` matches
`Option::or`, but not `Option::and`.
2023-06-16 21:43:28 +00:00
|
|
|
|
|
|
|
// Now, generic correction
|
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
|
|
|
// Intentionally wrong spelling of "NotableStructWithLongName"
|
|
|
|
write: (".search-input", "NotableStructWithLongNamr, NotableStructWithLongNamr")
|
|
|
|
// To be SURE that the search will be run.
|
|
|
|
press-key: 'Enter'
|
|
|
|
// Waiting for the search results to appear...
|
|
|
|
wait-for: "#search-tabs"
|
|
|
|
|
|
|
|
assert-css: (".search-corrections", {
|
|
|
|
"display": "block"
|
|
|
|
})
|
|
|
|
assert-text: (
|
|
|
|
".search-corrections",
|
|
|
|
"Type \"notablestructwithlongnamr\" not found and used as generic parameter. Consider searching for \"notablestructwithlongname\" instead."
|
|
|
|
)
|
|
|
|
|
|
|
|
// Now, generic correction plus error
|
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
|
|
|
// Intentionally wrong spelling of "NotableStructWithLongName"
|
2023-08-05 21:06:24 +00:00
|
|
|
write: (".search-input", "Foo<NotableStructWithLongNamr>,y")
|
rustdoc-search: add support for type parameters
When writing a type-driven search query in rustdoc, specifically one
with more than one query element, non-existent types become generic
parameters instead of auto-correcting (which is currently only done
for single-element queries) or giving no result. You can also force a
generic type parameter by writing `generic:T` (and can force it to not
use a generic type parameter with something like `struct:T` or whatever,
though if this happens it means the thing you're looking for doesn't
exist and will give you no results).
There is no syntax provided for specifying type constraints
for generic type parameters.
When you have a generic type parameter in a search query, it will only
match up with generic type parameters in the actual function, not
concrete types that match, not concrete types that implement a trait.
It also strictly matches based on when they're the same or different,
so `option<T>, option<U> -> option<U>` matches `Option::and`, but not
`Option::or`. Similarly, `option<T>, option<T> -> option<T>`` matches
`Option::or`, but not `Option::and`.
2023-06-16 21:43:28 +00:00
|
|
|
// To be SURE that the search will be run.
|
|
|
|
press-key: 'Enter'
|
|
|
|
// Waiting for the search results to appear...
|
|
|
|
wait-for: "#search-tabs"
|
|
|
|
|
|
|
|
assert-css: (".search-corrections", {
|
|
|
|
"display": "block"
|
|
|
|
})
|
|
|
|
assert-text: (
|
|
|
|
".search-corrections",
|
|
|
|
"Type \"notablestructwithlongnamr\" not found and used as generic parameter. Consider searching for \"notablestructwithlongname\" instead."
|
|
|
|
)
|
|
|
|
|
2023-08-05 21:06:24 +00:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
|
|
|
// Intentionally wrong spelling of "NotableStructWithLongName"
|
|
|
|
write: (".search-input", "generic:NotableStructWithLongNamr<x>,y")
|
|
|
|
// To be SURE that the search will be run.
|
|
|
|
press-key: 'Enter'
|
|
|
|
// Waiting for the search results to appear...
|
|
|
|
wait-for: "#search-tabs"
|
|
|
|
|
rustdoc-search: add support for type parameters
When writing a type-driven search query in rustdoc, specifically one
with more than one query element, non-existent types become generic
parameters instead of auto-correcting (which is currently only done
for single-element queries) or giving no result. You can also force a
generic type parameter by writing `generic:T` (and can force it to not
use a generic type parameter with something like `struct:T` or whatever,
though if this happens it means the thing you're looking for doesn't
exist and will give you no results).
There is no syntax provided for specifying type constraints
for generic type parameters.
When you have a generic type parameter in a search query, it will only
match up with generic type parameters in the actual function, not
concrete types that match, not concrete types that implement a trait.
It also strictly matches based on when they're the same or different,
so `option<T>, option<U> -> option<U>` matches `Option::and`, but not
`Option::or`. Similarly, `option<T>, option<T> -> option<T>`` matches
`Option::or`, but not `Option::and`.
2023-06-16 21:43:28 +00:00
|
|
|
assert-css: (".error", {
|
|
|
|
"display": "block"
|
|
|
|
})
|
|
|
|
assert-text: (
|
|
|
|
".error",
|
|
|
|
"Query parser error: \"Generic type parameter notablestructwithlongnamr does not accept generic parameters\"."
|
|
|
|
)
|