Skip to content

Commit cfb4af8

Browse files
Add GUI test for rustdoc search errors background
1 parent 6b0b654 commit cfb4af8

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

tests/rustdoc-gui/search-error.goml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Checks that the crate search filtering is handled correctly and changes the results.
2+
goto: "file://" + |DOC_PATH| + "/test_docs/index.html?search=sa'%3Bda'%3Bds"
3+
show-text: true
4+
5+
define-function: (
6+
"check-colors",
7+
(theme, error_background),
8+
block {
9+
// Setting the theme.
10+
local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
11+
// We reload the page so the local storage settings are being used.
12+
reload:
13+
14+
wait-for: "#search .error code"
15+
assert-css: ("#search .error code", {"background-color": |error_background|})
16+
}
17+
)
18+
19+
call-function: (
20+
"check-colors",
21+
{
22+
"theme": "ayu",
23+
"error_background": "rgb(79, 76, 76)",
24+
},
25+
)
26+
call-function: (
27+
"check-colors",
28+
{
29+
"theme": "dark",
30+
"error_background": "rgb(72, 72, 72)",
31+
},
32+
)
33+
call-function: (
34+
"check-colors",
35+
{
36+
"theme": "light",
37+
"error_background": "rgb(208, 204, 204)",
38+
},
39+
)

tests/rustdoc-js-std/parser-errors.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const PARSED = [
6767
returned: [],
6868
typeFilter: -1,
6969
userQuery: "a<\"p\">",
70-
error: "`\"` cannot be used in generics",
70+
error: "Unexpected `\"` in generics",
7171
},
7272
{
7373
elems: [],
@@ -373,7 +373,7 @@ const PARSED = [
373373
returned: [],
374374
typeFilter: -1,
375375
userQuery: "a!a",
376-
error: '`!` can only be at the end of an ident',
376+
error: 'Unexpected `!`: it can only be at the end of an ident',
377377
},
378378
{
379379
elems: [],

0 commit comments

Comments
 (0)