Skip to content

Commit

Permalink
test(package): Verify mixed-case Cargo.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Jul 26, 2023
1 parent 3166e5f commit 9b14e39
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions tests/testsuite/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3041,6 +3041,7 @@ src/main.rs
&[],
);
}

#[cargo_test]
#[cfg(windows)] // windows is the platform that is most consistently configured for case insensitive filesystems
fn no_manifest_found() {
Expand Down Expand Up @@ -3098,3 +3099,59 @@ src/main.rs
&[],
);
}

#[cargo_test]
#[cfg(target_os = "linux")] // linux is generally configured to be case sensitive
fn mixed_case() {
let manifest = r#"
[package]
name = "foo"
version = "0.0.1"
authors = []
exclude = ["*.txt"]
license = "MIT"
description = "foo"
"#;
let p = project()
.file("Cargo.toml", manifest)
.file("cargo.toml", manifest)
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
.file("src/bar.txt", "") // should be ignored when packaging
.build();

p.cargo("package")
.with_stderr(
"\
[WARNING] manifest has no documentation[..]
See [..]
[PACKAGING] foo v0.0.1 ([CWD])
[VERIFYING] foo v0.0.1 ([CWD])
[COMPILING] foo v0.0.1 ([CWD][..])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[PACKAGED] 6 files, [..] ([..] compressed)
",
)
.run();
assert!(p.root().join("target/package/foo-0.0.1.crate").is_file());
p.cargo("package -l")
.with_stdout(
"\
Cargo.lock
Cargo.toml
Cargo.toml
Cargo.toml.orig
Cargo.toml.orig
src/main.rs
",
)
.run();
p.cargo("package").with_stdout("").run();

let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap();
validate_crate_contents(
f,
"foo-0.0.1.crate",
&["Cargo.lock", "Cargo.toml", "Cargo.toml.orig", "src/main.rs"],
&[],
);
}

0 comments on commit 9b14e39

Please sign in to comment.