Skip to content

Commit 525e250

Browse files
author
Stefan Hoelzl
committed
added testcase
1 parent 1072b35 commit 525e250

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

tests/testsuite/package.rs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,3 +1420,51 @@ fn gitignore_negate() {
14201420
",
14211421
);
14221422
}
1423+
1424+
#[cargo_test]
1425+
fn include_dotfile() {
1426+
let p = project()
1427+
.file(
1428+
"Cargo.toml",
1429+
r#"
1430+
[project]
1431+
name = "foo"
1432+
version = "0.0.1"
1433+
"#,
1434+
)
1435+
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
1436+
.file(".hidden", "") // should be included when packaging
1437+
.build();
1438+
1439+
p.cargo("package")
1440+
.with_stderr(
1441+
"\
1442+
[WARNING] manifest has no [..]
1443+
See [..]
1444+
[PACKAGING] foo v0.0.1 ([CWD])
1445+
[VERIFYING] foo v0.0.1 ([CWD])
1446+
[COMPILING] foo v0.0.1 ([CWD][..])
1447+
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
1448+
",
1449+
)
1450+
.run();
1451+
assert!(p.root().join("target/package/foo-0.0.1.crate").is_file());
1452+
p.cargo("package -l")
1453+
.with_stdout(
1454+
"\
1455+
.hidden
1456+
Cargo.lock
1457+
Cargo.toml
1458+
src/main.rs
1459+
",
1460+
)
1461+
.run();
1462+
1463+
let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap();
1464+
validate_crate_contents(
1465+
f,
1466+
"foo-0.0.1.crate",
1467+
&[".hidden", "Cargo.lock", "Cargo.toml", "Cargo.toml.orig", "src/main.rs"],
1468+
&[],
1469+
);
1470+
}

0 commit comments

Comments
 (0)