Skip to content

Commit fcff51b

Browse files
committed
Add test for bad renaming
1 parent 420608b commit fcff51b

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/testsuite/build.rs

+31
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,37 @@ required by package `foo v0.0.1 ([CWD])`
911911
.run();
912912
}
913913

914+
// Ensure that renamed deps have a valid name
915+
#[cargo_test]
916+
fn cargo_compile_with_invalid_dep_rename() {
917+
let p = project()
918+
.file(
919+
"Cargo.toml",
920+
r#"
921+
[package]
922+
name = "buggin"
923+
version = "0.1.0"
924+
925+
[dependencies]
926+
"haha this isn't a valid name 🐛" = { package = "libc", version = "0.1" }
927+
"#,
928+
)
929+
.file("src/main.rs", &main_file(r#""What's good?""#, &[]))
930+
.build();
931+
932+
p.cargo("build")
933+
.with_status(101)
934+
.with_stderr(
935+
"\
936+
error: failed to parse manifest at `[..]`
937+
938+
Caused by:
939+
invalid character ` ` in dependency name: `haha this isn't a valid name 🐛`, characters must be Unicode XID characters (numbers, `-`, `_`, or most letters)
940+
",
941+
)
942+
.run();
943+
}
944+
914945
#[cargo_test]
915946
fn cargo_compile_with_filename() {
916947
let p = project()

0 commit comments

Comments
 (0)