Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rustdoc gui tester #112962

Merged
merged 3 commits into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/tools/rustdoc-gui-test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fn find_librs<P: AsRef<Path>>(path: P) -> Option<PathBuf> {
None
}

fn main() {
fn main() -> Result<(), ()> {
let config = Arc::new(Config::from_args(env::args().collect()));

// The goal here is to check if the necessary packages are installed, and if not, we
Expand Down Expand Up @@ -128,7 +128,10 @@ If you want to install the `browser-ui-test` dependency, run `npm install browse
}
}

try_run(&mut cargo, config.verbose);
if !try_run(&mut cargo, config.verbose) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at cause if this bug, i want to slap must_use over try_run and find all similar places.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea. Doing that shortly.

eprintln!("failed to document `{}`", entry.path().display());
panic!("Cannot run rustdoc-gui tests");
}
}
}

Expand Down Expand Up @@ -158,5 +161,5 @@ If you want to install the `browser-ui-test` dependency, run `npm install browse

command.args(&config.test_args);

try_run(&mut command, config.verbose);
if try_run(&mut command, config.verbose) { Ok(()) } else { Err(()) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using assert! with a simple error message on all try_run usages?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message would be less good because of the panic. I think try_run should return a Result instead of a boolean. Impossible to ignore it this way.

}
5 changes: 4 additions & 1 deletion tests/rustdoc-gui/search-result-color.goml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ define-function: (
// color of the typename (struct, module, method, ...) before search results
assert-css: (
".result-name .typename",
{"color": "#888"},
{"color": |grey|},
ALL,
)
},
Expand Down Expand Up @@ -75,6 +75,7 @@ store-value: (entry_color, "#0096cf") // color of the search entry
store-value: (hover_entry_color, "#fff") // color of the hovered/focused search entry
store-value: (background_color, "transparent") // background color
store-value: (hover_background_color, "#3c3c3c") // hover background color
store-value: (grey, "#999")

call-function: (
"check-result-color", (
Expand Down Expand Up @@ -186,6 +187,7 @@ store-value: (entry_color, "#ddd") // color of the search entry
store-value: (hover_entry_color, "#ddd") // color of the hovered/focused search entry
store-value: (background_color, "transparent") // background color
store-value: (hover_background_color, "#616161") // hover background color
store-value: (grey, "#ccc")

call-function: (
"check-result-color", (
Expand Down Expand Up @@ -282,6 +284,7 @@ store-value: (entry_color, "#000") // color of the search entry
store-value: (hover_entry_color, "#000") // color of the hovered/focused search entry
store-value: (background_color, "transparent") // background color
store-value: (hover_background_color, "#ccc") // hover background color
store-value: (grey, "#999")

call-function: (
"check-result-color", (
Expand Down