From 2da2ade0f7b289cd2d670fa6c77f50b3559ede2b Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Wed, 22 Mar 2023 21:12:40 -0700 Subject: Rename tests to ensure they don't have overlapping names. Some tests will delete their output directory before starting. The output directory is based on the test names. If one test is the prefix of another test, then when that test starts, it could try to delete the output directory of the other test with the longer path. --- tests/rustdoc/primitive.rs | 21 -------------- tests/rustdoc/primitive/primitive.rs | 21 ++++++++++++++ tests/ui/impl-trait/multiple-lifetimes.rs | 12 -------- .../multiple-lifetimes/multiple-lifetimes.rs | 12 ++++++++ .../mod_file_disambig_aux/compiletest-ignore-dir | 0 .../x/y/z/compiletest-ignore-dir | 0 tests/ui/use.rs | 23 --------------- tests/ui/use/use-mod.rs | 19 ------------- tests/ui/use/use-mod.stderr | 33 ---------------------- tests/ui/use/use-mod/use-mod.rs | 19 +++++++++++++ tests/ui/use/use-mod/use-mod.stderr | 33 ++++++++++++++++++++++ tests/ui/use/use.rs | 23 +++++++++++++++ 12 files changed, 108 insertions(+), 108 deletions(-) delete mode 100644 tests/rustdoc/primitive.rs create mode 100644 tests/rustdoc/primitive/primitive.rs delete mode 100644 tests/ui/impl-trait/multiple-lifetimes.rs create mode 100644 tests/ui/impl-trait/multiple-lifetimes/multiple-lifetimes.rs create mode 100644 tests/ui/modules_and_files_visibility/mod_file_disambig_aux/compiletest-ignore-dir create mode 100644 tests/ui/non_modrs_mods_and_inline_mods/x/y/z/compiletest-ignore-dir delete mode 100644 tests/ui/use.rs delete mode 100644 tests/ui/use/use-mod.rs delete mode 100644 tests/ui/use/use-mod.stderr create mode 100644 tests/ui/use/use-mod/use-mod.rs create mode 100644 tests/ui/use/use-mod/use-mod.stderr create mode 100644 tests/ui/use/use.rs diff --git a/tests/rustdoc/primitive.rs b/tests/rustdoc/primitive.rs deleted file mode 100644 index 516c7c0c6fe..00000000000 --- a/tests/rustdoc/primitive.rs +++ /dev/null @@ -1,21 +0,0 @@ -#![crate_name = "foo"] - -#![feature(rustdoc_internals)] - -// @has foo/index.html '//h2[@id="primitives"]' 'Primitive Types' -// @has foo/index.html '//a[@href="primitive.i32.html"]' 'i32' -// @has foo/index.html '//div[@class="sidebar-elems"]//li/a' 'Primitive Types' -// @has foo/index.html '//div[@class="sidebar-elems"]//li/a/@href' '#primitives' -// @has foo/primitive.i32.html '//a[@class="primitive"]' 'i32' -// @has foo/primitive.i32.html '//h1' 'Primitive Type i32' -// @has foo/primitive.i32.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!' -// @has foo/index.html '//a/@href' '../foo/index.html' -// @!has foo/index.html '//span' '🔒' -#[doc(primitive = "i32")] -/// this is a test! -mod i32{} - -// @has foo/primitive.bool.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'hello' -#[doc(primitive = "bool")] -/// hello -mod bool {} diff --git a/tests/rustdoc/primitive/primitive.rs b/tests/rustdoc/primitive/primitive.rs new file mode 100644 index 00000000000..516c7c0c6fe --- /dev/null +++ b/tests/rustdoc/primitive/primitive.rs @@ -0,0 +1,21 @@ +#![crate_name = "foo"] + +#![feature(rustdoc_internals)] + +// @has foo/index.html '//h2[@id="primitives"]' 'Primitive Types' +// @has foo/index.html '//a[@href="primitive.i32.html"]' 'i32' +// @has foo/index.html '//div[@class="sidebar-elems"]//li/a' 'Primitive Types' +// @has foo/index.html '//div[@class="sidebar-elems"]//li/a/@href' '#primitives' +// @has foo/primitive.i32.html '//a[@class="primitive"]' 'i32' +// @has foo/primitive.i32.html '//h1' 'Primitive Type i32' +// @has foo/primitive.i32.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!' +// @has foo/index.html '//a/@href' '../foo/index.html' +// @!has foo/index.html '//span' '🔒' +#[doc(primitive = "i32")] +/// this is a test! +mod i32{} + +// @has foo/primitive.bool.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'hello' +#[doc(primitive = "bool")] +/// hello +mod bool {} diff --git a/tests/ui/impl-trait/multiple-lifetimes.rs b/tests/ui/impl-trait/multiple-lifetimes.rs deleted file mode 100644 index 5407fb6dd28..00000000000 --- a/tests/ui/impl-trait/multiple-lifetimes.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Test that multiple lifetimes are allowed in impl trait types. -// build-pass (FIXME(62277): could be check-pass?) - -trait X<'x>: Sized {} - -impl X<'_> for U {} - -fn multiple_lifeteimes<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl X<'b> + 'a { - x -} - -fn main() {} diff --git a/tests/ui/impl-trait/multiple-lifetimes/multiple-lifetimes.rs b/tests/ui/impl-trait/multiple-lifetimes/multiple-lifetimes.rs new file mode 100644 index 00000000000..5407fb6dd28 --- /dev/null +++ b/tests/ui/impl-trait/multiple-lifetimes/multiple-lifetimes.rs @@ -0,0 +1,12 @@ +// Test that multiple lifetimes are allowed in impl trait types. +// build-pass (FIXME(62277): could be check-pass?) + +trait X<'x>: Sized {} + +impl X<'_> for U {} + +fn multiple_lifeteimes<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl X<'b> + 'a { + x +} + +fn main() {} diff --git a/tests/ui/modules_and_files_visibility/mod_file_disambig_aux/compiletest-ignore-dir b/tests/ui/modules_and_files_visibility/mod_file_disambig_aux/compiletest-ignore-dir new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/ui/non_modrs_mods_and_inline_mods/x/y/z/compiletest-ignore-dir b/tests/ui/non_modrs_mods_and_inline_mods/x/y/z/compiletest-ignore-dir new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/ui/use.rs b/tests/ui/use.rs deleted file mode 100644 index 1beee4a5143..00000000000 --- a/tests/ui/use.rs +++ /dev/null @@ -1,23 +0,0 @@ -// run-pass - -#![allow(stable_features)] -// pretty-expanded FIXME #23616 - -#![allow(unused_imports)] -#![feature(start, no_core, core)] -#![no_core] - -extern crate std; -extern crate std as zed; - -use std::str; -use zed::str as x; - -use std::io::{self, Error as IoError, Result as IoResult}; -use std::error::{self as foo}; -mod baz { - pub use std::str as x; -} - -#[start] -pub fn start(_: isize, _: *const *const u8) -> isize { 0 } diff --git a/tests/ui/use/use-mod.rs b/tests/ui/use/use-mod.rs deleted file mode 100644 index 87064c6a42b..00000000000 --- a/tests/ui/use/use-mod.rs +++ /dev/null @@ -1,19 +0,0 @@ -use foo::bar::{ - self, -//~^ ERROR `self` import can only appear once in an import list - Bar, - self -//~^ ERROR the name `bar` is defined multiple times -}; - -use {self}; -//~^ ERROR `self` import can only appear in an import list with a non-empty prefix - -mod foo { - pub mod bar { - pub struct Bar; - pub struct Baz; - } -} - -fn main() {} diff --git a/tests/ui/use/use-mod.stderr b/tests/ui/use/use-mod.stderr deleted file mode 100644 index 0cae5eb14ae..00000000000 --- a/tests/ui/use/use-mod.stderr +++ /dev/null @@ -1,33 +0,0 @@ -error[E0430]: `self` import can only appear once in an import list - --> $DIR/use-mod.rs:2:5 - | -LL | self, - | ^^^^ can only appear once in an import list -... -LL | self - | ---- another `self` import appears here - -error[E0431]: `self` import can only appear in an import list with a non-empty prefix - --> $DIR/use-mod.rs:9:6 - | -LL | use {self}; - | ^^^^ can only appear in an import list with a non-empty prefix - -error[E0252]: the name `bar` is defined multiple times - --> $DIR/use-mod.rs:5:5 - | -LL | self, - | ---- previous import of the module `bar` here -... -LL | self - | ^^^^ - | | - | `bar` reimported here - | help: remove unnecessary import - | - = note: `bar` must be defined only once in the type namespace of this module - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0252, E0430, E0431. -For more information about an error, try `rustc --explain E0252`. diff --git a/tests/ui/use/use-mod/use-mod.rs b/tests/ui/use/use-mod/use-mod.rs new file mode 100644 index 00000000000..87064c6a42b --- /dev/null +++ b/tests/ui/use/use-mod/use-mod.rs @@ -0,0 +1,19 @@ +use foo::bar::{ + self, +//~^ ERROR `self` import can only appear once in an import list + Bar, + self +//~^ ERROR the name `bar` is defined multiple times +}; + +use {self}; +//~^ ERROR `self` import can only appear in an import list with a non-empty prefix + +mod foo { + pub mod bar { + pub struct Bar; + pub struct Baz; + } +} + +fn main() {} diff --git a/tests/ui/use/use-mod/use-mod.stderr b/tests/ui/use/use-mod/use-mod.stderr new file mode 100644 index 00000000000..0cae5eb14ae --- /dev/null +++ b/tests/ui/use/use-mod/use-mod.stderr @@ -0,0 +1,33 @@ +error[E0430]: `self` import can only appear once in an import list + --> $DIR/use-mod.rs:2:5 + | +LL | self, + | ^^^^ can only appear once in an import list +... +LL | self + | ---- another `self` import appears here + +error[E0431]: `self` import can only appear in an import list with a non-empty prefix + --> $DIR/use-mod.rs:9:6 + | +LL | use {self}; + | ^^^^ can only appear in an import list with a non-empty prefix + +error[E0252]: the name `bar` is defined multiple times + --> $DIR/use-mod.rs:5:5 + | +LL | self, + | ---- previous import of the module `bar` here +... +LL | self + | ^^^^ + | | + | `bar` reimported here + | help: remove unnecessary import + | + = note: `bar` must be defined only once in the type namespace of this module + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0252, E0430, E0431. +For more information about an error, try `rustc --explain E0252`. diff --git a/tests/ui/use/use.rs b/tests/ui/use/use.rs new file mode 100644 index 00000000000..1beee4a5143 --- /dev/null +++ b/tests/ui/use/use.rs @@ -0,0 +1,23 @@ +// run-pass + +#![allow(stable_features)] +// pretty-expanded FIXME #23616 + +#![allow(unused_imports)] +#![feature(start, no_core, core)] +#![no_core] + +extern crate std; +extern crate std as zed; + +use std::str; +use zed::str as x; + +use std::io::{self, Error as IoError, Result as IoResult}; +use std::error::{self as foo}; +mod baz { + pub use std::str as x; +} + +#[start] +pub fn start(_: isize, _: *const *const u8) -> isize { 0 } -- cgit 1.4.1-3-g733a5