about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-10-21 14:11:08 +0900
committerGitHub <noreply@github.com>2021-10-21 14:11:08 +0900
commit47a1f67a8d953f0c1c76f5cabed5d92df30eb512 (patch)
treef319384e6ea8d8877946e09e3d4393f906d25a2c /src
parent632f06d8eb586e9386723fa54a71c1dd19605a11 (diff)
parent457f5782f30b5ded5558d02f161ae7e71b5d4ad8 (diff)
downloadrust-47a1f67a8d953f0c1c76f5cabed5d92df30eb512.tar.gz
rust-47a1f67a8d953f0c1c76f5cabed5d92df30eb512.zip
Rollup merge of #90048 - GuillaumeGomez:line-number-setting, r=jsha
Add test for line-number setting

The first commit updates the version of the package to be able to have multi-line commands (which looks much nicer for this test).

r? ````@jsha````
Diffstat (limited to 'src')
-rw-r--r--src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile2
-rw-r--r--src/test/rustdoc-gui/docblock-code-block-line-number.goml22
-rw-r--r--src/test/rustdoc-gui/src/test_docs/lib.rs1
3 files changed, 24 insertions, 1 deletions
diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile
index adc970c66d6..ba4e1ca3114 100644
--- a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile
+++ b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile
@@ -72,7 +72,7 @@ ENV PATH="/node-v14.4.0-linux-x64/bin:${PATH}"
 # https://github.com/puppeteer/puppeteer/issues/375
 #
 # We also specify the version in case we need to update it to go around cache limitations.
-RUN npm install -g browser-ui-test@0.4.3 --unsafe-perm=true
+RUN npm install -g browser-ui-test@0.4.5 --unsafe-perm=true
 
 ENV RUST_CONFIGURE_ARGS \
   --build=x86_64-unknown-linux-gnu \
diff --git a/src/test/rustdoc-gui/docblock-code-block-line-number.goml b/src/test/rustdoc-gui/docblock-code-block-line-number.goml
new file mode 100644
index 00000000000..7e6607b55ea
--- /dev/null
+++ b/src/test/rustdoc-gui/docblock-code-block-line-number.goml
@@ -0,0 +1,22 @@
+// Checks that the setting "line numbers" is working as expected.
+goto: file://|DOC_PATH|/test_docs/fn.foo.html
+
+// We check that without this setting, there is no line number displayed.
+assert-false: "pre.line-number"
+
+// We now set the setting to show the line numbers on code examples.
+local-storage: {"rustdoc-line-numbers": "true" }
+// We reload to make the line numbers appear.
+reload:
+
+// We wait for them to be added into the DOM by the JS...
+wait-for: "pre.line-number"
+// If the test didn't fail, it means that it was found!
+// Let's now check some CSS properties...
+assert-css: ("pre.line-number", {
+    "margin": "0px",
+    "padding": "13px 8px",
+    "text-align": "right"
+})
+// The first code block has two lines so let's check its `<pre>` elements lists both of them.
+assert-text: ("pre.line-number", "1\n2")
diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs
index 2a147e64d8b..76a36ccd684 100644
--- a/src/test/rustdoc-gui/src/test_docs/lib.rs
+++ b/src/test/rustdoc-gui/src/test_docs/lib.rs
@@ -12,6 +12,7 @@ use std::fmt;
 ///
 /// ```
 /// println!("nothing fancy");
+/// println!("but with two lines!");
 /// ```
 ///
 /// A failing to compile one: