diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 86d940cd733da..62c458fe81770 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -734,9 +734,24 @@ impl Step for RustdocGUI { } let out_dir = builder.test_out(self.target).join("rustdoc-gui"); - let mut command = builder.rustdoc_cmd(self.compiler); - command.arg("src/test/rustdoc-gui/lib.rs").arg("-o").arg(&out_dir); - builder.run(&mut command); + + for file in fs::read_dir("src/test/rustdoc-gui").unwrap() { + let file = file.unwrap(); + let file_name = file.file_name(); + + if !file_name.to_str().unwrap().ends_with(".rs") { + continue; + } + + let mut command = builder.rustdoc_cmd(self.compiler); + command + .arg(&Path::new("src/test/rustdoc-gui").join(file_name)) + .arg("-o") + .arg(&out_dir) + .arg("-Zunstable-options") + .arg("--generate-case-insensitive"); + builder.run(&mut command); + } for file in fs::read_dir("src/test/rustdoc-gui").unwrap() { let file = file.unwrap(); @@ -750,7 +765,7 @@ impl Step for RustdocGUI { command .arg("src/tools/rustdoc-gui/tester.js") .arg("--doc-folder") - .arg(out_dir.join("test_docs")) + .arg(&out_dir) .arg("--test-file") .arg(file_path); builder.run(&mut command); diff --git a/src/test/rustdoc-gui/basic-code.goml b/src/test/rustdoc-gui/basic-code.goml index 8da465662547a..d014ed60eb039 100644 --- a/src/test/rustdoc-gui/basic-code.goml +++ b/src/test/rustdoc-gui/basic-code.goml @@ -1,3 +1,3 @@ -goto: file://|DOC_PATH|/index.html +goto: file://|DOC_PATH|/test_docs/index.html click: ".srclink" assert: (".line-numbers", 1) diff --git a/src/test/rustdoc-gui/basic.goml b/src/test/rustdoc-gui/basic.goml index ed23300860b70..44fcec3393744 100644 --- a/src/test/rustdoc-gui/basic.goml +++ b/src/test/rustdoc-gui/basic.goml @@ -1,4 +1,4 @@ -goto: file://|DOC_PATH|/index.html +goto: file://|DOC_PATH|/test_docs/index.html assert: ("#functions") goto: ./struct.Foo.html assert: ("div.type-decl") diff --git a/src/test/rustdoc-gui/check_info_sign_position.goml b/src/test/rustdoc-gui/check_info_sign_position.goml index 9aa72a3ad53e7..d64ee0261370c 100644 --- a/src/test/rustdoc-gui/check_info_sign_position.goml +++ b/src/test/rustdoc-gui/check_info_sign_position.goml @@ -1,4 +1,4 @@ -goto: file://|DOC_PATH|/index.html +goto: file://|DOC_PATH|/test_docs/index.html goto: ./fn.check_list_code_block.html // If the codeblock is the first element of the docblock, the information tooltip must have // have some top margin to avoid going over the toggle (the "[+]"). diff --git a/src/test/rustdoc-gui/code-sidebar-toggle.goml b/src/test/rustdoc-gui/code-sidebar-toggle.goml index 69fc860244b7b..7e7003d4340a3 100644 --- a/src/test/rustdoc-gui/code-sidebar-toggle.goml +++ b/src/test/rustdoc-gui/code-sidebar-toggle.goml @@ -1,4 +1,4 @@ -goto: file://|DOC_PATH|/index.html +goto: file://|DOC_PATH|/test_docs/index.html click: ".srclink" click: "#sidebar-toggle" wait-for: 500 diff --git a/src/test/rustdoc-gui/insensitive-case-check.goml b/src/test/rustdoc-gui/insensitive-case-check.goml new file mode 100644 index 0000000000000..d25fbfac70b7b --- /dev/null +++ b/src/test/rustdoc-gui/insensitive-case-check.goml @@ -0,0 +1,7 @@ +goto: file://|DOC_PATH|/insensitive_case_docs/struct.ab.html +// Checks that the sidebar was filled. +wait-for: ".sidebar-elems > .items > .sidebar-title" +// Checks that the content has been loaded +assert: ".impl-items > h4" +// Checks that the collapse toggles have been generated as expected +assert: ".impl-items > h4 > .collapse-toggle" diff --git a/src/test/rustdoc-gui/insensitive-test.rs b/src/test/rustdoc-gui/insensitive-test.rs new file mode 100644 index 0000000000000..6f63c32127a51 --- /dev/null +++ b/src/test/rustdoc-gui/insensitive-test.rs @@ -0,0 +1,19 @@ +//! The point of this crate is to test the insensitive case handling. + +#![crate_name = "insensitive_case_docs"] + +#![allow(non_camel_case_types)] + +/// This is ab. +pub struct ab; + +impl ab { + pub fn foo(&self) {} +} + +/// This is another Ab! +pub struct Ab; + +impl Ab { + pub fn bar(&self) {} +} diff --git a/src/test/rustdoc-gui/list_code_block.goml b/src/test/rustdoc-gui/list_code_block.goml index 6f2465a5587f2..7d3490e9d9410 100644 --- a/src/test/rustdoc-gui/list_code_block.goml +++ b/src/test/rustdoc-gui/list_code_block.goml @@ -1,3 +1,3 @@ -goto: file://|DOC_PATH|/index.html +goto: file://|DOC_PATH|/test_docs/index.html goto: ./fn.check_list_code_block.html assert: ("pre.rust.fn") diff --git a/src/test/rustdoc-gui/nojs-attr-pos.goml b/src/test/rustdoc-gui/nojs-attr-pos.goml index 35daa4cb9e322..0e87c93ab3b32 100644 --- a/src/test/rustdoc-gui/nojs-attr-pos.goml +++ b/src/test/rustdoc-gui/nojs-attr-pos.goml @@ -1,5 +1,5 @@ // Check that the attributes are well positioned when javascript is disabled (since // there is no toggle to display) javascript: false -goto: file://|DOC_PATH|/struct.Foo.html +goto: file://|DOC_PATH|/test_docs/struct.Foo.html assert: (".attributes", {"margin-left": "0px"}) diff --git a/src/test/rustdoc-gui/search-input-mobile.goml b/src/test/rustdoc-gui/search-input-mobile.goml index 3eec3459a6393..5c95db70aecdd 100644 --- a/src/test/rustdoc-gui/search-input-mobile.goml +++ b/src/test/rustdoc-gui/search-input-mobile.goml @@ -1,6 +1,6 @@ // Test to ensure that you can click on the search input, whatever the width. // The PR which fixed it is: https://github.com/rust-lang/rust/pull/81592 -goto: file://|DOC_PATH|/index.html +goto: file://|DOC_PATH|/test_docs/index.html size: (463, 700) // We first check that the search input isn't already focused. assert-false: ("input.search-input:focus") diff --git a/src/test/rustdoc-gui/shortcuts.goml b/src/test/rustdoc-gui/shortcuts.goml index c35b48f57f4d2..884c38d85fbdb 100644 --- a/src/test/rustdoc-gui/shortcuts.goml +++ b/src/test/rustdoc-gui/shortcuts.goml @@ -1,5 +1,5 @@ // Check that the various shortcuts are working. -goto: file://|DOC_PATH|/index.html +goto: file://|DOC_PATH|/test_docs/index.html // We first check that the search input isn't already focused. assert-false: "input.search-input:focus" press-key: "s" diff --git a/src/test/rustdoc-gui/theme-change.goml b/src/test/rustdoc-gui/theme-change.goml index 5bd65f61f4905..bc9063edd1e7a 100644 --- a/src/test/rustdoc-gui/theme-change.goml +++ b/src/test/rustdoc-gui/theme-change.goml @@ -1,4 +1,4 @@ -goto: file://|DOC_PATH|/index.html +goto: file://|DOC_PATH|/test_docs/index.html click: "#theme-picker" click: "#theme-choices > button:first-child" wait-for: 500 diff --git a/src/test/rustdoc-gui/toggle-docs.goml b/src/test/rustdoc-gui/toggle-docs.goml index 1ded33f659d3c..93bdf41a6a09e 100644 --- a/src/test/rustdoc-gui/toggle-docs.goml +++ b/src/test/rustdoc-gui/toggle-docs.goml @@ -1,4 +1,4 @@ -goto: file://|DOC_PATH|/index.html +goto: file://|DOC_PATH|/test_docs/index.html click: "#toggle-all-docs" wait-for: 5000 assert: ("#main > div.docblock.hidden-by-usual-hider") diff --git a/src/test/rustdoc-gui/trait-sidebar-item-order.goml b/src/test/rustdoc-gui/trait-sidebar-item-order.goml index 914486e1c281d..2e9f85336ecd8 100644 --- a/src/test/rustdoc-gui/trait-sidebar-item-order.goml +++ b/src/test/rustdoc-gui/trait-sidebar-item-order.goml @@ -1,4 +1,4 @@ -goto: file://|DOC_PATH|/trait.AnotherOne.html +goto: file://|DOC_PATH|/test_docs/trait.AnotherOne.html assert: (".sidebar-links a:nth-of-type(1)", "another") assert: (".sidebar-links a:nth-of-type(2)", "func1") assert: (".sidebar-links a:nth-of-type(3)", "func2") diff --git a/src/test/rustdoc/insensitive-case.rs b/src/test/rustdoc/insensitive-case.rs new file mode 100644 index 0000000000000..a64e794adcf01 --- /dev/null +++ b/src/test/rustdoc/insensitive-case.rs @@ -0,0 +1,18 @@ +// compile-flags: -Zunstable-options --generate-case-insensitive + +#![crate_name = "foo"] + +// @!has 'foo/struct.Aa.html' +// @has 'foo/struct.aa.html' +// @!has 'foo/struct.aa.html' '//h4[@id="method.new"]' +pub struct aa; + +impl aa { + pub fn foo(&self) {} +} + +pub struct Aa; + +impl Aa { + pub fn foo(&self) {} +}