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

Add test for line-number setting #90048

Merged
merged 2 commits into from
Oct 21, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
22 changes: 22 additions & 0 deletions src/test/rustdoc-gui/docblock-code-block-line-number.goml
Original file line number Diff line number Diff line change
@@ -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")
1 change: 1 addition & 0 deletions src/test/rustdoc-gui/src/test_docs/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use std::fmt;
///
/// ```
/// println!("nothing fancy");
/// println!("but with two lines!");
/// ```
///
/// A failing to compile one:
Expand Down