Skip to content

Commit

Permalink
Rollup merge of #104201 - GuillaumeGomez:gui-test-check-file-errors, …
Browse files Browse the repository at this point in the history
…r=notriddle

Add check in GUI test for file loading failure

Since #101702, some resources location need to be updated in case their content changed because then their hash will change too. This will prevent errors like #104114 to happen again.

The second commit is to prevent CORS errors: when a file is linked from a file itself imported, the web browser considers they come from a different domain and therefore triggers the error. The option tells the web browser to ignore this case.

cc ``@jsha``
r? ``@notriddle``
  • Loading branch information
Manishearth authored Nov 10, 2022
2 parents f7b8884 + 9f0e376 commit d829264
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.12.7
0.13.1
4 changes: 4 additions & 0 deletions src/test/rustdoc-gui/code-tags.goml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// This test ensures that items and documentation code blocks are wrapped in <pre><code>

// We need to disable this check because `implementors/test_docs/trait.AnotherOne.js`
// doesn't exist.
fail-on-request-error: false
goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
size: (1080, 600)
// There should be four doc codeblocks.
Expand Down
5 changes: 5 additions & 0 deletions src/test/rustdoc-gui/item-decl-colors.goml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
// This test ensures that the color of the items in the type decl are working as expected.

// We need to disable this check because `implementors/test_docs/trait.TraitWithoutGenerics.js`
// doesn't exist.
fail-on-request-error: false

define-function: (
"check-colors",
(
Expand Down
5 changes: 5 additions & 0 deletions src/test/rustdoc-gui/no-docblock.goml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
// This test checks that there are margins applied to methods with no docblocks.

// We need to disable this check because `implementors/test_docs/trait.TraitWithNoDocblock.js`
// doesn't exist.
fail-on-request-error: false

goto: "file://" + |DOC_PATH| + "/test_docs/trait.TraitWithNoDocblocks.html"
// Check that the two methods are more than 24px apart.
compare-elements-position-near-false: ("//*[@id='tymethod.first_fn']", "//*[@id='tymethod.second_fn']", {"y": 24})
Expand Down
5 changes: 5 additions & 0 deletions src/test/rustdoc-gui/trait-sidebar-item-order.goml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
// Checks that the elements in the sidebar are alphabetically sorted.

// We need to disable this check because `implementors/test_docs/trait.AnotherOne.js`
// doesn't exist.
fail-on-request-error: false

goto: "file://" + |DOC_PATH| + "/test_docs/trait.AnotherOne.html"
assert-text: (".sidebar-elems section .block li:nth-of-type(1) > a", "another")
assert-text: (".sidebar-elems section .block li:nth-of-type(2) > a", "func1")
Expand Down
6 changes: 6 additions & 0 deletions src/test/rustdoc-gui/type-declation-overflow.goml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
// This test ensures that the items declaration content overflow is handled inside the <pre> directly.

// We need to disable this check because
// `implementors/test_docs/trait.ALongNameBecauseItHelpsTestingTheCurrentProblem.js`
// doesn't exist.
fail-on-request-error: false

goto: "file://" + |DOC_PATH| + "/lib2/long_trait/trait.ALongNameBecauseItHelpsTestingTheCurrentProblem.html"
// We set a fixed size so there is no chance of "random" resize.
size: (1100, 800)
Expand Down
1 change: 1 addition & 0 deletions src/tools/rustdoc-gui/tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ async function main(argv) {
// This is more convenient that setting fields one by one.
let args = [
"--variable", "DOC_PATH", opts["doc_folder"], "--enable-fail-on-js-error",
"--allow-file-access-from-files",
];
if (opts["debug"]) {
debug = true;
Expand Down

0 comments on commit d829264

Please sign in to comment.