2024-06-23 15:31:27 -05:00
|
|
|
use run_make_support::regex::Regex;
|
|
|
|
use run_make_support::{cwd, rfs, rustc};
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let invalid_characters = [".foo.rs", ".foo.bar", "+foo+bar.rs"];
|
|
|
|
let re = Regex::new(r"invalid character.*in crate name:").unwrap();
|
|
|
|
for f in invalid_characters {
|
2024-07-17 07:42:06 -05:00
|
|
|
rfs::copy("foo.rs", f);
|
2024-06-23 15:31:27 -05:00
|
|
|
let stderr = rustc().input(f).run_fail().stderr_utf8();
|
|
|
|
assert!(re.is_match(&stderr));
|
|
|
|
}
|
|
|
|
|
2024-07-17 07:42:06 -05:00
|
|
|
rfs::copy("foo.rs", "-foo.rs");
|
2024-06-23 15:31:27 -05:00
|
|
|
rustc()
|
|
|
|
.input(cwd().join("-foo.rs"))
|
|
|
|
.run_fail()
|
|
|
|
.assert_stderr_contains("crate names cannot start with a `-`");
|
|
|
|
}
|