fix rustdoc tests broke by trait item filtering

This commit is contained in:
binarycat 2025-09-02 11:41:21 -05:00
parent c407d340de
commit 2dd00d3391
6 changed files with 42 additions and 35 deletions

View file

@ -5,7 +5,7 @@ include: "utils.goml"
define-function: (
"check-search-color",
[
theme, count_color, desc_color, path_color, bottom_border_color, keyword_color,
theme, count_color, path_color, bottom_border_color, keyword_color,
struct_color, associatedtype_color, tymethod_color, method_color, structfield_color,
structfield_hover_color, macro_color, fn_color, hover_path_color, hover_background,
attribute_color, grey
@ -21,10 +21,6 @@ define-function: (
{"color": |count_color|},
ALL,
)
assert-css: (
"//*[@class='desc'][normalize-space()='Just a normal struct.']",
{"color": |desc_color|},
)
assert-css: (
"//*[@class='result-name']//*[normalize-space()='test_docs::']",
{"color": |path_color|},
@ -97,16 +93,6 @@ define-function: (
ALL,
)
// Checking color and background on hover.
move-cursor-to: "//*[@class='desc'][normalize-space()='Just a normal struct.']"
assert-css: (
"//*[@class='result-name']//*[normalize-space()='test_docs::']",
{"color": |hover_path_color|},
)
assert-css: (
"//*[@class='result-name']//*[normalize-space()='test_docs::']/ancestor::a",
{"color": |hover_path_color|, "background-color": |hover_background|},
)
}
)
@ -157,7 +143,6 @@ show-text: true
call-function: ("check-search-color", {
"theme": "ayu",
"count_color": "#888",
"desc_color": "#c5c5c5",
"path_color": "#0096cf",
"bottom_border_color": "#aaa3",
"keyword_color": "#39afd7",
@ -179,7 +164,6 @@ call-function: ("check-search-color", {
call-function: ("check-search-color", {
"theme": "dark",
"count_color": "#888",
"desc_color": "#ddd",
"path_color": "#ddd",
"bottom_border_color": "#aaa3",
"keyword_color": "#d2991d",
@ -201,7 +185,6 @@ call-function: ("check-search-color", {
call-function: ("check-search-color", {
"theme": "light",
"count_color": "#888",
"desc_color": "#000",
"path_color": "#000",
"bottom_border_color": "#aaa3",
"keyword_color": "#3873ad",
@ -226,12 +209,27 @@ call-function: ("perform-search", {"query": "thisisanalias"})
define-function: (
"check-alias",
[theme, alias, grey],
[theme, alias, grey, desc_color, hover_path_color, hover_background],
block {
call-function: ("switch-theme", {"theme": |theme|})
// Checking that the colors for the alias element are the ones expected.
assert-css: (".result-name .path .alias", {"color": |alias|})
assert-css: (".result-name .path .alias > .grey", {"color": |grey|})
assert-css: (
"//*[@class='desc'][normalize-space()='Just a normal enum.']",
{"color": |desc_color|},
)
// Checking color and background on hover.
move-cursor-to: "//*[@class='desc'][normalize-space()='Just a normal enum.']"
assert-css: (
"//*[@class='result-name']//*[normalize-space()='test_docs::']",
{"color": |hover_path_color|},
)
assert-css: (
"//*[@class='result-name']//*[normalize-space()='test_docs::']/ancestor::a",
{"color": |hover_path_color|, "background-color": |hover_background|},
)
},
)
@ -239,14 +237,23 @@ call-function: ("check-alias", {
"theme": "ayu",
"alias": "#c5c5c5",
"grey": "#999",
"desc_color": "#c5c5c5",
"hover_path_color": "#fff",
"hover_background": "#3c3c3c",
})
call-function: ("check-alias", {
"theme": "dark",
"alias": "#fff",
"grey": "#ccc",
"desc_color": "#ddd",
"hover_path_color": "#ddd",
"hover_background": "#616161",
})
call-function: ("check-alias", {
"theme": "light",
"alias": "#000",
"grey": "#999",
"desc_color": "#000",
"hover_path_color": "#000",
"hover_background": "#ccc",
})

View file

@ -79,7 +79,7 @@ call-function: ("check-colors", {
set-window-size: (851, 600)
// Check the size and count in tabs
assert-text: ("#search-tabs > button:nth-child(1) > .count", "(27)")
assert-text: ("#search-tabs > button:nth-child(1) > .count", "(25)")
assert-text: ("#search-tabs > button:nth-child(2) > .count", "(7)")
assert-text: ("#search-tabs > button:nth-child(3) > .count", "(0)")
store-property: ("#search-tabs > button:nth-child(1)", {"offsetWidth": buttonWidth})

View file

@ -1,5 +1,7 @@
// Checks multiple things on the sidebar display (width of its elements, colors, etc).
include: "utils.goml"
// Disable animations so they don't mess up color assertions later.
emulate-media-features: { "prefers-reduced-motion": "reduce" }
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
assert-property: (".sidebar", {"clientWidth": "199"})
show-text: true

View file

@ -1,12 +1,10 @@
// ignore-order
const EXPECTED = {
'query': 'RawFd::as_raw_fd',
'query': 'method: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.
{ 'path': 'std::os::fd::AsRawFd', 'name': 'as_raw_fd' },
{ 'path': 'std::os::fd::AsRawFd', 'name': 'as_raw_fd' },
{ 'path': 'std::os::fd::RawFd', 'name': 'as_raw_fd' },
],
};

View file

@ -1,21 +1,21 @@
// make sure quoted search works both for items and and without generics
// ignore-order
const FILTER_CRATE = 'std';
const EXPECTED = {
'query': '"error"',
'query': '"result"',
'others': [
{ 'path': 'std', 'name': 'error' },
{ 'path': 'std::fmt', 'name': 'Error' },
{ 'path': 'std::io', 'name': 'Error' },
{ 'path': 'std', 'name': 'result' },
{ 'path': 'std::result', 'name': 'Result' },
{ 'path': 'std::fmt', 'name': 'Result' },
],
'in_args': [
{ 'path': 'std::fmt::Error', 'name': 'eq' },
{ 'path': 'std::fmt::Error', 'name': 'cmp' },
{ 'path': 'std::fmt::Error', 'name': 'partial_cmp' },
{ 'path': 'std::result::Result', 'name': 'branch' },
{ 'path': 'std::result::Result', 'name': 'ok' },
{ 'path': 'std::result::Result', 'name': 'unwrap' },
],
'returned': [
{ 'path': 'std::fmt::LowerExp', 'name': 'fmt' },
{ 'path': 'std::bool', 'name': 'try_into' },
],
};

View file

@ -1,10 +1,10 @@
// ignore-order
// make sure type-based searches with traits get unboxed too
const EXPECTED = [
{
'query': 'bufread -> result<[u8]>',
'query': 'any -> result<box>',
'others': [
{ 'path': 'std::boxed::Box', 'name': 'fill_buf' },
{ 'path': 'std::boxed::Box', 'name': 'downcast' },
],
},
{