Skip to content

Commit 5d11325

Browse files
Rollup merge of rust-lang#106602 - GuillaumeGomez:tidy-goml-scripts, r=Mark-Simulacrum
Add goml scripts to tidy checks r? `@notriddle`
2 parents bc17e62 + 31b39be commit 5d11325

File tree

8 files changed

+45
-16
lines changed

8 files changed

+45
-16
lines changed

src/test/rustdoc-gui/escape-key.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
55
write: (".search-input", "test")
66
// To be SURE that the search will be run.
77
press-key: 'Enter'
8-
wait-for: "#search h1" // The search element is empty before the first search
8+
wait-for: "#search h1" // The search element is empty before the first search
99
// Check that the currently displayed element is search.
1010
wait-for: "#alternative-display #search"
1111
assert-attribute: ("#main-content", {"class": "content hidden"})

src/test/rustdoc-gui/impl-doc.goml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ goto: "file://" + |DOC_PATH| + "/test_docs/struct.TypeWithImplDoc.html"
33

44
// The text is about 24px tall, so if there's a margin, then their position will be >24px apart
55
compare-elements-position-near-false: (
6-
"#implementations-list > .implementors-toggle > .docblock > p",
7-
"#implementations-list > .implementors-toggle > .impl-items",
8-
{"y": 24}
6+
"#implementations-list > .implementors-toggle > .docblock > p",
7+
"#implementations-list > .implementors-toggle > .impl-items",
8+
{"y": 24}
99
)

src/test/rustdoc-gui/mobile.goml

+5-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,8 @@ assert-css-false: (".content .out-of-band .since::before", { "content": "\"Since
2727
goto: "file://" + |DOC_PATH| + "/settings.html"
2828
size: (400, 600)
2929
// Ignored for now https://github.com/rust-lang/rust/issues/93784.
30-
// compare-elements-position-near-false: ("#preferred-light-theme .setting-name", "#preferred-light-theme .choice", {"y": 16})
30+
// compare-elements-position-near-false: (
31+
// "#preferred-light-theme .setting-name",
32+
// "#preferred-light-theme .choice",
33+
// {"y": 16},
34+
// )

src/test/rustdoc-gui/rust-logo.goml

+18-3
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,28 @@ define-function: (
3131

3232
call-function: (
3333
"check-logo",
34-
("ayu", "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px 1px 0px) drop-shadow(rgb(255, 255, 255) -1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px -1px 0px)"),
34+
{
35+
"theme": "ayu",
36+
"filter": "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) " +
37+
"drop-shadow(rgb(255, 255, 255) 0px 1px 0px) " +
38+
"drop-shadow(rgb(255, 255, 255) -1px 0px 0px) " +
39+
"drop-shadow(rgb(255, 255, 255) 0px -1px 0px)",
40+
},
3541
)
3642
call-function: (
3743
"check-logo",
38-
("dark", "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px 1px 0px) drop-shadow(rgb(255, 255, 255) -1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px -1px 0px)"),
44+
{
45+
"theme": "dark",
46+
"filter": "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) " +
47+
"drop-shadow(rgb(255, 255, 255) 0px 1px 0px) " +
48+
"drop-shadow(rgb(255, 255, 255) -1px 0px 0px) " +
49+
"drop-shadow(rgb(255, 255, 255) 0px -1px 0px)",
50+
},
3951
)
4052
call-function: (
4153
"check-logo",
42-
("light", "none"),
54+
{
55+
"theme": "light",
56+
"filter": "none",
57+
},
4358
)

src/test/rustdoc-gui/scrape-examples-button-focus.goml

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@ store-property: (initialScrollTop, ".scraped-example-list > .scraped-example pre
55
focus: ".scraped-example-list > .scraped-example .next"
66
press-key: "Enter"
77
assert-property-false: (".scraped-example-list > .scraped-example pre", {
8-
"scrollTop": |initialScrollTop|
8+
"scrollTop": |initialScrollTop|
99
})
1010
focus: ".scraped-example-list > .scraped-example .prev"
1111
press-key: "Enter"
1212
assert-property: (".scraped-example-list > .scraped-example pre", {
13-
"scrollTop": |initialScrollTop|
13+
"scrollTop": |initialScrollTop|
1414
})
1515

1616
// The expand button increases the scrollHeight of the minimized code viewport
1717
store-property: (smallOffsetHeight, ".scraped-example-list > .scraped-example pre", "offsetHeight")
1818
assert-property-false: (".scraped-example-list > .scraped-example pre", {
19-
"scrollHeight": |smallOffsetHeight|
19+
"scrollHeight": |smallOffsetHeight|
2020
})
2121
focus: ".scraped-example-list > .scraped-example .expand"
2222
press-key: "Enter"
2323
assert-property-false: (".scraped-example-list > .scraped-example pre", {
24-
"offsetHeight": |smallOffsetHeight|
24+
"offsetHeight": |smallOffsetHeight|
2525
})
2626
store-property: (fullOffsetHeight, ".scraped-example-list > .scraped-example pre", "offsetHeight")
2727
assert-property: (".scraped-example-list > .scraped-example pre", {
28-
"scrollHeight": |fullOffsetHeight|
28+
"scrollHeight": |fullOffsetHeight|
2929
})

src/test/rustdoc-gui/sidebar.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,4 @@ assert-text: ("#toggle-all-docs", "[+]")
148148
assert-property: (".sidebar", {"clientWidth": "200"})
149149
click: "#toggle-all-docs"
150150
assert-text: ("#toggle-all-docs", "[−]")
151-
assert-property: (".sidebar", {"clientWidth": "200"})
151+
assert-property: (".sidebar", {"clientWidth": "200"})

src/test/rustdoc-gui/type-declation-overflow.goml

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// ignore-tidy-linelength
12
// This test ensures that the items declaration content overflow is handled inside the <pre> directly.
23

34
// We need to disable this check because

src/tools/tidy/src/style.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use std::path::Path;
2525
/// displayed on the console with --example.
2626
const ERROR_CODE_COLS: usize = 80;
2727
const COLS: usize = 100;
28+
const GOML_COLS: usize = 120;
2829

2930
const LINES: usize = 3000;
3031

@@ -230,7 +231,8 @@ pub fn check(path: &Path, bad: &mut bool) {
230231
walk(path, &mut skip, &mut |entry, contents| {
231232
let file = entry.path();
232233
let filename = file.file_name().unwrap().to_string_lossy();
233-
let extensions = [".rs", ".py", ".js", ".sh", ".c", ".cpp", ".h", ".md", ".css", ".ftl"];
234+
let extensions =
235+
[".rs", ".py", ".js", ".sh", ".c", ".cpp", ".h", ".md", ".css", ".ftl", ".goml"];
234236
if extensions.iter().all(|e| !filename.ends_with(e)) || filename.starts_with(".#") {
235237
return;
236238
}
@@ -255,8 +257,15 @@ pub fn check(path: &Path, bad: &mut bool) {
255257

256258
let extension = file.extension().unwrap().to_string_lossy();
257259
let is_error_code = extension == "md" && is_in(file, "src", "error_codes");
260+
let is_goml_code = extension == "goml";
258261

259-
let max_columns = if is_error_code { ERROR_CODE_COLS } else { COLS };
262+
let max_columns = if is_error_code {
263+
ERROR_CODE_COLS
264+
} else if is_goml_code {
265+
GOML_COLS
266+
} else {
267+
COLS
268+
};
260269

261270
let can_contain = contents.contains("// ignore-tidy-")
262271
|| contents.contains("# ignore-tidy-")

0 commit comments

Comments
 (0)