Skip to content

Commit 9b14e39

Browse files
committed
test(package): Verify mixed-case Cargo.toml
1 parent 3166e5f commit 9b14e39

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

tests/testsuite/package.rs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3041,6 +3041,7 @@ src/main.rs
30413041
&[],
30423042
);
30433043
}
3044+
30443045
#[cargo_test]
30453046
#[cfg(windows)] // windows is the platform that is most consistently configured for case insensitive filesystems
30463047
fn no_manifest_found() {
@@ -3098,3 +3099,59 @@ src/main.rs
30983099
&[],
30993100
);
31003101
}
3102+
3103+
#[cargo_test]
3104+
#[cfg(target_os = "linux")] // linux is generally configured to be case sensitive
3105+
fn mixed_case() {
3106+
let manifest = r#"
3107+
[package]
3108+
name = "foo"
3109+
version = "0.0.1"
3110+
authors = []
3111+
exclude = ["*.txt"]
3112+
license = "MIT"
3113+
description = "foo"
3114+
"#;
3115+
let p = project()
3116+
.file("Cargo.toml", manifest)
3117+
.file("cargo.toml", manifest)
3118+
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
3119+
.file("src/bar.txt", "") // should be ignored when packaging
3120+
.build();
3121+
3122+
p.cargo("package")
3123+
.with_stderr(
3124+
"\
3125+
[WARNING] manifest has no documentation[..]
3126+
See [..]
3127+
[PACKAGING] foo v0.0.1 ([CWD])
3128+
[VERIFYING] foo v0.0.1 ([CWD])
3129+
[COMPILING] foo v0.0.1 ([CWD][..])
3130+
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
3131+
[PACKAGED] 6 files, [..] ([..] compressed)
3132+
",
3133+
)
3134+
.run();
3135+
assert!(p.root().join("target/package/foo-0.0.1.crate").is_file());
3136+
p.cargo("package -l")
3137+
.with_stdout(
3138+
"\
3139+
Cargo.lock
3140+
Cargo.toml
3141+
Cargo.toml
3142+
Cargo.toml.orig
3143+
Cargo.toml.orig
3144+
src/main.rs
3145+
",
3146+
)
3147+
.run();
3148+
p.cargo("package").with_stdout("").run();
3149+
3150+
let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap();
3151+
validate_crate_contents(
3152+
f,
3153+
"foo-0.0.1.crate",
3154+
&["Cargo.lock", "Cargo.toml", "Cargo.toml.orig", "src/main.rs"],
3155+
&[],
3156+
);
3157+
}

0 commit comments

Comments
 (0)