about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/bootstrap/test.rs5
-rw-r--r--src/librustdoc/html/static/css/themes/ayu.css2
-rw-r--r--src/test/rustdoc-gui/jump-to-def-background.goml23
-rw-r--r--src/test/rustdoc-gui/src/link_to_definition/Cargo.lock7
-rw-r--r--src/test/rustdoc-gui/src/link_to_definition/Cargo.toml7
-rw-r--r--src/test/rustdoc-gui/src/link_to_definition/lib.rs6
6 files changed, 49 insertions, 1 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index d12e86b7c1d..386ffb384a8 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -925,6 +925,11 @@ impl Step for RustdocGUI {
                     .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);
             }
         }
diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css
index f9ddef4120b..eada8f4a04d 100644
--- a/src/librustdoc/html/static/css/themes/ayu.css
+++ b/src/librustdoc/html/static/css/themes/ayu.css
@@ -217,7 +217,7 @@ a {
 	color: #c5c5c5;
 }
 body.source .example-wrap pre.rust a {
-	background: #c5c5c5;
+	background: #333;
 }
 
 .docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),
diff --git a/src/test/rustdoc-gui/jump-to-def-background.goml b/src/test/rustdoc-gui/jump-to-def-background.goml
new file mode 100644
index 00000000000..3df899e0f26
--- /dev/null
+++ b/src/test/rustdoc-gui/jump-to-def-background.goml
@@ -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)
diff --git a/src/test/rustdoc-gui/src/link_to_definition/Cargo.lock b/src/test/rustdoc-gui/src/link_to_definition/Cargo.lock
new file mode 100644
index 00000000000..e4b4e52d028
--- /dev/null
+++ b/src/test/rustdoc-gui/src/link_to_definition/Cargo.lock
@@ -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"
diff --git a/src/test/rustdoc-gui/src/link_to_definition/Cargo.toml b/src/test/rustdoc-gui/src/link_to_definition/Cargo.toml
new file mode 100644
index 00000000000..cdd294d74d3
--- /dev/null
+++ b/src/test/rustdoc-gui/src/link_to_definition/Cargo.toml
@@ -0,0 +1,7 @@
+[package]
+name = "link_to_definition"
+version = "0.1.0"
+edition = "2018"
+
+[lib]
+path = "lib.rs"
diff --git a/src/test/rustdoc-gui/src/link_to_definition/lib.rs b/src/test/rustdoc-gui/src/link_to_definition/lib.rs
new file mode 100644
index 00000000000..de9ee66a2ba
--- /dev/null
+++ b/src/test/rustdoc-gui/src/link_to_definition/lib.rs
@@ -0,0 +1,6 @@
+pub struct Bar {
+    pub a: String,
+    pub b: u32,
+}
+
+pub fn foo(_b: &Bar) {}