Skip to content

Commit 009064f

Browse files
Use new block syntax for define-function in goml scripts
1 parent f67aa04 commit 009064f

31 files changed

+573
-591
lines changed

src/test/rustdoc-gui/anchors.goml

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,70 +3,72 @@
33
define-function: (
44
"check-colors",
55
(theme, main_color, title_color, fqn_color, fqn_type_color, src_link_color, sidebar_link_color),
6-
[
7-
("goto", "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html"),
6+
block {
7+
goto: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html"
88
// This is needed to ensure that the text color is computed.
9-
("show-text", true),
9+
show-text: true
1010

1111
// Setting the theme.
12-
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
12+
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
1313
// We reload the page so the local storage settings are being used.
14-
("reload"),
14+
reload:
1515

16-
("assert-css", ("#toggle-all-docs", {"color": |main_color|})),
17-
("assert-css", (".fqn a:nth-of-type(1)", {"color": |fqn_color|})),
18-
("assert-css", (".fqn a:nth-of-type(2)", {"color": |fqn_type_color|})),
19-
("assert-css", (
16+
assert-css: ("#toggle-all-docs", {"color": |main_color|})
17+
assert-css: (".fqn a:nth-of-type(1)", {"color": |fqn_color|})
18+
assert-css: (".fqn a:nth-of-type(2)", {"color": |fqn_type_color|})
19+
assert-css: (
2020
".rightside .srclink",
2121
{"color": |src_link_color|, "text-decoration": "none solid " + |src_link_color|},
2222
ALL,
23-
)),
24-
(
25-
"compare-elements-css",
26-
(".rightside .srclink", ".rightside.srclink", ["color", "text-decoration"]),
27-
),
28-
(
29-
"compare-elements-css",
30-
(".main-heading .srclink", ".rightside.srclink", ["color", "text-decoration"]),
31-
),
23+
)
24+
compare-elements-css: (
25+
".rightside .srclink",
26+
".rightside.srclink",
27+
["color", "text-decoration"],
28+
)
29+
compare-elements-css: (
30+
".main-heading .srclink",
31+
".rightside.srclink",
32+
["color", "text-decoration"],
33+
)
3234

33-
("move-cursor-to", ".main-heading .srclink"),
34-
("assert-css", (
35+
move-cursor-to: ".main-heading .srclink"
36+
assert-css: (
3537
".main-heading .srclink",
3638
{"color": |src_link_color|, "text-decoration": "underline solid " + |src_link_color|},
37-
)),
38-
("move-cursor-to", ".impl-items .rightside .srclink"),
39-
("assert-css", (
39+
)
40+
move-cursor-to: ".impl-items .rightside .srclink"
41+
assert-css: (
4042
".impl-items .rightside .srclink",
4143
{"color": |src_link_color|, "text-decoration": "none solid " + |src_link_color|},
42-
)),
43-
("move-cursor-to", ".impl-items .rightside.srclink"),
44-
("assert-css", (
44+
)
45+
move-cursor-to: ".impl-items .rightside.srclink"
46+
assert-css: (
4547
".impl-items .rightside.srclink",
4648
{"color": |src_link_color|, "text-decoration": "none solid " + |src_link_color|},
47-
)),
49+
)
4850

49-
("goto", "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"),
51+
goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
5052
// Since we changed page, we need to set the theme again.
51-
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
53+
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
5254
// We reload the page so the local storage settings are being used.
53-
("reload"),
55+
reload:
5456

55-
("assert-css", ("#top-doc-prose-title", {"color": |title_color|})),
57+
assert-css: ("#top-doc-prose-title", {"color": |title_color|})
5658

57-
("assert-css", (".sidebar a", {"color": |sidebar_link_color|})),
58-
("assert-css", ("h1.fqn a", {"color": |title_color|})),
59+
assert-css: (".sidebar a", {"color": |sidebar_link_color|})
60+
assert-css: ("h1.fqn a", {"color": |title_color|})
5961

6062
// We move the cursor over the "Implementations" title so the anchor is displayed.
61-
("move-cursor-to", "h2#implementations"),
62-
("assert-css", ("h2#implementations a.anchor", {"color": |main_color|})),
63+
move-cursor-to: "h2#implementations"
64+
assert-css: ("h2#implementations a.anchor", {"color": |main_color|})
6365

6466
// Same thing with the impl block title.
65-
("move-cursor-to", "#impl-HeavilyDocumentedStruct"),
66-
("assert-css", ("#impl-HeavilyDocumentedStruct a.anchor", {"color": |main_color|})),
67+
move-cursor-to: "#impl-HeavilyDocumentedStruct"
68+
assert-css: ("#impl-HeavilyDocumentedStruct a.anchor", {"color": |main_color|})
6769

68-
("assert-css", ("#title-for-struct-impl-item-doc", {"margin-left": "0px"})),
69-
],
70+
assert-css: ("#title-for-struct-impl-item-doc", {"margin-left": "0px"})
71+
},
7072
)
7173

7274
call-function: (

src/test/rustdoc-gui/code-color.goml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ show-text: true
99
define-function: (
1010
"check-colors",
1111
(theme, doc_code_color, doc_inline_code_color),
12-
[
12+
block {
1313
// Set the theme.
14-
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
14+
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
1515
// We reload the page so the local storage settings are being used.
16-
("reload"),
17-
("assert-css", (".docblock pre > code", {"color": |doc_code_color|}, ALL)),
18-
("assert-css", (".docblock > p > code", {"color": |doc_inline_code_color|}, ALL)),
19-
],
16+
reload:
17+
assert-css: (".docblock pre > code", {"color": |doc_code_color|}, ALL)
18+
assert-css: (".docblock > p > code", {"color": |doc_inline_code_color|}, ALL)
19+
},
2020
)
2121

2222
call-function: ("check-colors", ("ayu", "rgb(230, 225, 207)", "rgb(255, 180, 84)"))

src/test/rustdoc-gui/codeblock-tooltip.goml

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,32 @@ show-text: true
55
define-function: (
66
"check-colors",
77
(theme, background, color, border),
8-
[
8+
block {
99
// Setting the theme.
10-
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
11-
("reload"),
10+
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
11+
reload:
1212

1313
// compile_fail block
14-
("assert-css", (
14+
assert-css: (
1515
".docblock .example-wrap.compile_fail .tooltip",
1616
{"color": "rgba(255, 0, 0, 0.5)"},
17-
)),
18-
("assert-css", (
17+
)
18+
assert-css: (
1919
".docblock .example-wrap.compile_fail",
2020
{"border-left": "2px solid rgba(255, 0, 0, 0.5)"},
21-
)),
21+
)
2222

23-
("move-cursor-to", ".docblock .example-wrap.compile_fail .tooltip"),
23+
move-cursor-to: ".docblock .example-wrap.compile_fail .tooltip"
2424

25-
("assert-css", (
25+
assert-css: (
2626
".docblock .example-wrap.compile_fail .tooltip",
2727
{"color": "rgb(255, 0, 0)"},
28-
)),
29-
("assert-css", (
28+
)
29+
assert-css: (
3030
".docblock .example-wrap.compile_fail",
3131
{"border-left": "2px solid rgb(255, 0, 0)"},
32-
)),
33-
("assert-css", (
32+
)
33+
assert-css: (
3434
".docblock .example-wrap.compile_fail .tooltip::after",
3535
{
3636
"content": '"This example deliberately fails to compile"',
@@ -39,37 +39,37 @@ define-function: (
3939
"color": |color|,
4040
"border": "1px solid " + |border|,
4141
},
42-
)),
43-
("assert-css", (
42+
)
43+
assert-css: (
4444
".docblock .example-wrap.compile_fail .tooltip::before",
4545
{
4646
"border-width": "5px",
4747
"border-style": "solid",
4848
"border-color": "rgba(0, 0, 0, 0) " + |background| + " rgba(0, 0, 0, 0) rgba(0, 0, 0, 0)",
4949
},
50-
)),
50+
)
5151

5252
// should_panic block
53-
("assert-css", (
53+
assert-css: (
5454
".docblock .example-wrap.should_panic .tooltip",
5555
{"color": "rgba(255, 0, 0, 0.5)"},
56-
)),
57-
("assert-css", (
56+
)
57+
assert-css: (
5858
".docblock .example-wrap.should_panic",
5959
{"border-left": "2px solid rgba(255, 0, 0, 0.5)"},
60-
)),
60+
)
6161

62-
("move-cursor-to", ".docblock .example-wrap.should_panic .tooltip"),
62+
move-cursor-to: ".docblock .example-wrap.should_panic .tooltip"
6363

64-
("assert-css", (
64+
assert-css: (
6565
".docblock .example-wrap.should_panic .tooltip",
6666
{"color": "rgb(255, 0, 0)"},
67-
)),
68-
("assert-css", (
67+
)
68+
assert-css: (
6969
".docblock .example-wrap.should_panic",
7070
{"border-left": "2px solid rgb(255, 0, 0)"},
71-
)),
72-
("assert-css", (
71+
)
72+
assert-css: (
7373
".docblock .example-wrap.should_panic .tooltip::after",
7474
{
7575
"content": '"This example panics"',
@@ -78,37 +78,37 @@ define-function: (
7878
"color": |color|,
7979
"border": "1px solid " + |border|,
8080
},
81-
)),
82-
("assert-css", (
81+
)
82+
assert-css: (
8383
".docblock .example-wrap.should_panic .tooltip::before",
8484
{
8585
"border-width": "5px",
8686
"border-style": "solid",
8787
"border-color": "rgba(0, 0, 0, 0) " + |background| + " rgba(0, 0, 0, 0) rgba(0, 0, 0, 0)",
8888
},
89-
)),
89+
)
9090

9191
// ignore block
92-
("assert-css", (
92+
assert-css: (
9393
".docblock .example-wrap.ignore .tooltip",
9494
{"color": "rgba(255, 142, 0, 0.6)"},
95-
)),
96-
("assert-css", (
95+
)
96+
assert-css: (
9797
".docblock .example-wrap.ignore",
9898
{"border-left": "2px solid rgba(255, 142, 0, 0.6)"},
99-
)),
99+
)
100100

101-
("move-cursor-to", ".docblock .example-wrap.ignore .tooltip"),
101+
move-cursor-to: ".docblock .example-wrap.ignore .tooltip"
102102

103-
("assert-css", (
103+
assert-css: (
104104
".docblock .example-wrap.ignore .tooltip",
105105
{"color": "rgb(255, 142, 0)"},
106-
)),
107-
("assert-css", (
106+
)
107+
assert-css: (
108108
".docblock .example-wrap.ignore",
109109
{"border-left": "2px solid rgb(255, 142, 0)"},
110-
)),
111-
("assert-css", (
110+
)
111+
assert-css: (
112112
".docblock .example-wrap.ignore .tooltip::after",
113113
{
114114
"content": '"This example is not tested"',
@@ -117,16 +117,16 @@ define-function: (
117117
"color": |color|,
118118
"border": "1px solid " + |border|,
119119
},
120-
)),
121-
("assert-css", (
120+
)
121+
assert-css: (
122122
".docblock .example-wrap.ignore .tooltip::before",
123123
{
124124
"border-width": "5px",
125125
"border-style": "solid",
126126
"border-color": "rgba(0, 0, 0, 0) " + |background| + " rgba(0, 0, 0, 0) rgba(0, 0, 0, 0)",
127127
},
128-
)),
129-
],
128+
)
129+
},
130130
)
131131

132132
call-function: ("check-colors", {

src/test/rustdoc-gui/docblock-code-block-line-number.goml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ assert-false: "pre.example-line-numbers"
1111
define-function: (
1212
"check-colors",
1313
(theme, color),
14-
[
14+
block {
1515
// We now set the setting to show the line numbers on code examples.
16-
("local-storage", {
16+
local-storage: {
1717
"rustdoc-theme": |theme|,
1818
"rustdoc-use-system-theme": "false",
1919
"rustdoc-line-numbers": "true"
20-
}),
20+
}
2121
// We reload to make the line numbers appear and change theme.
22-
("reload"),
22+
reload:
2323
// We wait for them to be added into the DOM by the JS...
24-
("wait-for", "pre.example-line-numbers"),
24+
wait-for: "pre.example-line-numbers"
2525
// If the test didn't fail, it means that it was found!
26-
("assert-css", (
26+
assert-css: (
2727
"pre.example-line-numbers",
2828
{
2929
"color": |color|,
@@ -32,8 +32,8 @@ define-function: (
3232
"text-align": "right",
3333
},
3434
ALL,
35-
)),
36-
],
35+
)
36+
},
3737
)
3838
call-function: ("check-colors", {
3939
"theme": "ayu",

src/test/rustdoc-gui/docblock-table.goml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,32 @@ compare-elements-css: (".impl-items .docblock table td", ".top-doc .docblock tab
77
define-function: (
88
"check-colors",
99
(theme, border_color, zebra_stripe_color),
10-
[
11-
("local-storage", {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|}),
12-
("reload"),
13-
("assert-css", (".top-doc .docblock table tbody tr:nth-child(1)", {
10+
block {
11+
local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|}
12+
reload:
13+
assert-css: (".top-doc .docblock table tbody tr:nth-child(1)", {
1414
"background-color": "rgba(0, 0, 0, 0)",
15-
})),
16-
("assert-css", (".top-doc .docblock table tbody tr:nth-child(2)", {
15+
})
16+
assert-css: (".top-doc .docblock table tbody tr:nth-child(2)", {
1717
"background-color": |zebra_stripe_color|,
18-
})),
19-
("assert-css", (".top-doc .docblock table tbody tr:nth-child(3)", {
18+
})
19+
assert-css: (".top-doc .docblock table tbody tr:nth-child(3)", {
2020
"background-color": "rgba(0, 0, 0, 0)",
21-
})),
22-
("assert-css", (".top-doc .docblock table tbody tr:nth-child(4)", {
21+
})
22+
assert-css: (".top-doc .docblock table tbody tr:nth-child(4)", {
2323
"background-color": |zebra_stripe_color|,
24-
})),
25-
("assert-css", (".top-doc .docblock table td", {
24+
})
25+
assert-css: (".top-doc .docblock table td", {
2626
"border-style": "solid",
2727
"border-width": "1px",
2828
"border-color": |border_color|,
29-
})),
30-
("assert-css", (".top-doc .docblock table th", {
29+
})
30+
assert-css: (".top-doc .docblock table th", {
3131
"border-style": "solid",
3232
"border-width": "1px",
3333
"border-color": |border_color|,
34-
})),
35-
]
34+
})
35+
}
3636
)
3737

3838
call-function: ("check-colors", {

0 commit comments

Comments
 (0)