Skip to content

Commit

Permalink
Rollup merge of #105964 - notriddle:notriddle/scraped-example-length,…
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskrgr authored Dec 20, 2022
2 parents a039b22 + 168e3da commit 50cfffa
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ ul.block, .block li {
.rustdoc .example-wrap > pre.example-line-numbers,
.rustdoc .example-wrap > pre.src-line-numbers {
flex-grow: 0;
min-width: fit-content; /* prevent collapsing into nothing in truncated scraped examples */
overflow: initial;
text-align: right;
-webkit-user-select: none;
Expand Down
35 changes: 35 additions & 0 deletions src/test/rustdoc-gui/scrape-examples-layout.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Check that the line number column has the correct layout.
goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"

// Check that it's not zero.
assert-property-false: (
".more-scraped-examples .scraped-example .code-wrapper .src-line-numbers",
{"clientWidth": "0"}
)

// Check that examples with very long lines have the same width as ones that don't.
store-property: (
clientWidth,
".more-scraped-examples .scraped-example:nth-child(1) .code-wrapper .src-line-numbers",
"clientWidth"
)

assert-property: (
".more-scraped-examples .scraped-example:nth-child(2) .code-wrapper .src-line-numbers",
{"clientWidth": |clientWidth|}
)

assert-property: (
".more-scraped-examples .scraped-example:nth-child(3) .code-wrapper .src-line-numbers",
{"clientWidth": |clientWidth|}
)

assert-property: (
".more-scraped-examples .scraped-example:nth-child(4) .code-wrapper .src-line-numbers",
{"clientWidth": |clientWidth|}
)

assert-property: (
".more-scraped-examples .scraped-example:nth-child(5) .code-wrapper .src-line-numbers",
{"clientWidth": |clientWidth|}
)
10 changes: 10 additions & 0 deletions src/test/rustdoc-gui/src/scrape_examples/examples/check-many-1.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
fn main() {
// all examples have same line count
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
fn main() {
scrape_examples::test_many();
// ignore-tidy-linelength
scrape_examples::test_many(); /* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. */
scrape_examples::test_many(); /* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. */
scrape_examples::test_many(); /* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. */
scrape_examples::test_many(); /* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. */
scrape_examples::test_many(); /* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. */
scrape_examples::test_many(); /* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. */
scrape_examples::test_many(); /* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. */
scrape_examples::test_many(); /* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. */
scrape_examples::test_many(); /* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. */
scrape_examples::test_many(); /* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. */
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
fn main() {
scrape_examples::test_many();
// ignore-tidy-linelength
scrape_examples::test_many(); /* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. */
scrape_examples::test_many(); /* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. */
scrape_examples::test_many(); /* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. */
scrape_examples::test_many(); /* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. */
scrape_examples::test_many(); /* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. */
scrape_examples::test_many(); /* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. */
scrape_examples::test_many(); /* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. */
scrape_examples::test_many(); /* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. */
scrape_examples::test_many(); /* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. */
scrape_examples::test_many(); /* Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. */
}
10 changes: 10 additions & 0 deletions src/test/rustdoc-gui/src/scrape_examples/examples/check-many-4.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
fn main() {
// all examples have same line count
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
}
10 changes: 10 additions & 0 deletions src/test/rustdoc-gui/src/scrape_examples/examples/check-many-5.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
fn main() {
// all examples have same line count
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
}
10 changes: 10 additions & 0 deletions src/test/rustdoc-gui/src/scrape_examples/examples/check-many-6.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
fn main() {
// all examples have same line count
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
}
10 changes: 10 additions & 0 deletions src/test/rustdoc-gui/src/scrape_examples/examples/check-many-7.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
fn main() {
// all examples have same line count
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
scrape_examples::test_many();
}

0 comments on commit 50cfffa

Please sign in to comment.