fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
3.6 KiB106 linesraw
1// ignore-tidy-linelength
2
3// Checks that the search tab result tell the user about corrections
4// First, try a search-by-name
5go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
6// Intentionally wrong spelling of "NotableStructWithLongName"
7write: (".search-input", "NotableStructWithLongNamr")
8// To be SURE that the search will be run.
9press-key: 'Enter'
10// Waiting for the search results to appear...
11wait-for: "#search-tabs"
12
13// Corrections aren't shown on the "In Names" tab.
14assert: "#search-tabs button.selected:first-child"
15assert-css: (".search-corrections", {
16    "display": "none"
17})
18
19// Corrections do get shown on the "In Parameters" tab.
20click: "#search-tabs button:nth-child(2)"
21assert: "#search-tabs button.selected:nth-child(2)"
22assert-css: (".search-corrections", {
23    "display": "block"
24})
25assert-text: (
26    ".search-corrections",
27    "Type \"notablestructwithlongnamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead."
28)
29
30// Corrections do get shown on the "In Return Type" tab.
31click: "#search-tabs button:nth-child(3)"
32assert: "#search-tabs button.selected:nth-child(3)"
33assert-css: (".search-corrections", {
34    "display": "block"
35})
36assert-text: (
37    ".search-corrections",
38    "Type \"notablestructwithlongnamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead."
39)
40
41// Now, explicit return values
42go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
43// Intentionally wrong spelling of "NotableStructWithLongName"
44write: (".search-input", "-> NotableStructWithLongNamr")
45// To be SURE that the search will be run.
46press-key: 'Enter'
47// Waiting for the search results to appear...
48wait-for: "#search-tabs"
49
50assert-css: (".search-corrections", {
51    "display": "block"
52})
53assert-text: (
54    ".search-corrections",
55    "Type \"notablestructwithlongnamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead."
56)
57
58// Now, generic correction
59go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
60// Intentionally wrong spelling of "NotableStructWithLongName"
61write: (".search-input", "NotableStructWithLongNamr, NotableStructWithLongNamr")
62// To be SURE that the search will be run.
63press-key: 'Enter'
64// Waiting for the search results to appear...
65wait-for: "#search-tabs"
66
67assert-css: (".search-corrections", {
68    "display": "block"
69})
70assert-text: (
71    ".search-corrections",
72    "Type \"notablestructwithlongnamr\" not found and used as generic parameter. Consider searching for \"notablestructwithlongname\" instead."
73)
74
75// Now, generic correction plus error
76go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
77// Intentionally wrong spelling of "NotableStructWithLongName"
78write: (".search-input", "Foo<NotableStructWithLongNamr>,y")
79// To be SURE that the search will be run.
80press-key: 'Enter'
81// Waiting for the search results to appear...
82wait-for: "#search-tabs"
83
84assert-css: (".search-corrections", {
85    "display": "block"
86})
87assert-text: (
88    ".search-corrections",
89    "Type \"notablestructwithlongnamr\" not found and used as generic parameter. Consider searching for \"notablestructwithlongname\" instead."
90)
91
92go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
93// Intentionally wrong spelling of "NotableStructWithLongName"
94write: (".search-input", "generic:NotableStructWithLongNamr<x>,y")
95// To be SURE that the search will be run.
96press-key: 'Enter'
97// Waiting for the search results to appear...
98wait-for: "#search-tabs"
99
100assert-css: (".error", {
101    "display": "block"
102})
103assert-text: (
104    ".error",
105    "Query parser error: \"Generic type parameter notablestructwithlongnamr does not accept generic parameters\"."
106)