mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-07 09:13:07 +03:00
* Enable generate-link-to-def feature on a rustdoc GUI test
* Add test for jump-to-def links background color
This commit is contained in:
@@ -925,6 +925,11 @@ fn run(self, builder: &Builder<'_>) {
|
||||
.env("RUSTDOC", builder.rustdoc(self.compiler))
|
||||
.env("RUSTC", builder.rustc(self.compiler))
|
||||
.current_dir(path);
|
||||
// FIXME: implement a `// compile-flags` command or similar
|
||||
// instead of hard-coding this test
|
||||
if entry.file_name() == "link_to_definition" {
|
||||
cargo.env("RUSTDOCFLAGS", "-Zunstable-options --generate-link-to-definition");
|
||||
}
|
||||
builder.run(&mut cargo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// We check the background color on the jump to definition links in the source code page.
|
||||
goto: file://|DOC_PATH|/src/link_to_definition/lib.rs.html
|
||||
|
||||
// Set the theme to dark.
|
||||
local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"}
|
||||
// We reload the page so the local storage settings are being used.
|
||||
reload:
|
||||
|
||||
assert-css: ("body.source .example-wrap pre.rust a", {"background-color": "rgb(51, 51, 51)"}, ALL)
|
||||
|
||||
// Set the theme to ayu.
|
||||
local-storage: {"rustdoc-theme": "ayu", "rustdoc-preferred-dark-theme": "ayu", "rustdoc-use-system-theme": "false"}
|
||||
// We reload the page so the local storage settings are being used.
|
||||
reload:
|
||||
|
||||
assert-css: ("body.source .example-wrap pre.rust a", {"background-color": "rgb(51, 51, 51)"}, ALL)
|
||||
|
||||
// Set the theme to light.
|
||||
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
|
||||
// We reload the page so the local storage settings are being used.
|
||||
reload:
|
||||
|
||||
assert-css: ("body.source .example-wrap pre.rust a", {"background-color": "rgb(238, 238, 238)"}, ALL)
|
||||
@@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "link_to_definition"
|
||||
version = "0.1.0"
|
||||
@@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "link_to_definition"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
||||
@@ -0,0 +1,6 @@
|
||||
pub struct Bar {
|
||||
pub a: String,
|
||||
pub b: u32,
|
||||
}
|
||||
|
||||
pub fn foo(_b: &Bar) {}
|
||||
Reference in New Issue
Block a user