Skip to content

Commit 5dd39df

Browse files
committed
test(package): Verify cargo.toml behavior
1 parent e2fbcd9 commit 5dd39df

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
@@ -2983,3 +2983,60 @@ src/main.rs.bak
29832983
],
29842984
);
29852985
}
2986+
2987+
#[cargo_test]
2988+
#[cfg(windows)] // windows is the platform that is most consistently configured for case insensitive filesystems
2989+
fn normalize_case() {
2990+
let p = project()
2991+
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
2992+
.file("src/bar.txt", "") // should be ignored when packaging
2993+
.build();
2994+
// Workaround `project()` making a `Cargo.toml` on our behalf
2995+
std::fs::remove_file(p.root().join("Cargo.toml")).unwrap();
2996+
std::fs::write(
2997+
p.root().join("cargo.toml"),
2998+
r#"
2999+
[package]
3000+
name = "foo"
3001+
version = "0.0.1"
3002+
authors = []
3003+
exclude = ["*.txt"]
3004+
license = "MIT"
3005+
description = "foo"
3006+
"#,
3007+
)
3008+
.unwrap();
3009+
3010+
p.cargo("package")
3011+
.with_stderr(
3012+
"\
3013+
[WARNING] manifest has no documentation[..]
3014+
See [..]
3015+
[PACKAGING] foo v0.0.1 ([CWD])
3016+
[VERIFYING] foo v0.0.1 ([CWD])
3017+
[COMPILING] foo v0.0.1 ([CWD][..])
3018+
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
3019+
[PACKAGED] 3 files, [..] ([..] compressed)
3020+
",
3021+
)
3022+
.run();
3023+
assert!(p.root().join("target/package/foo-0.0.1.crate").is_file());
3024+
p.cargo("package -l")
3025+
.with_stdout(
3026+
"\
3027+
Cargo.lock
3028+
cargo.toml
3029+
src/main.rs
3030+
",
3031+
)
3032+
.run();
3033+
p.cargo("package").with_stdout("").run();
3034+
3035+
let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap();
3036+
validate_crate_contents(
3037+
f,
3038+
"foo-0.0.1.crate",
3039+
&["Cargo.lock", "cargo.toml", "src/main.rs"],
3040+
&[],
3041+
);
3042+
}

0 commit comments

Comments
 (0)