Skip to content

Commit 129769e

Browse files
committed
test(package): --no-gen-lockfile works
1 parent 0329777 commit 129769e

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

tests/testsuite/package.rs

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7309,20 +7309,22 @@ fn unpublished_cyclic_dev_dependencies() {
73097309
.file("src/lib.rs", "")
73107310
.build();
73117311

7312-
p.cargo("package --no-verify")
7313-
.with_status(101)
7312+
p.cargo("package --no-verify --exclude-lockfile")
73147313
.with_stderr_data(str![[r#"
73157314
[PACKAGING] foo v0.0.1 ([ROOT]/foo)
7316-
[UPDATING] `dummy-registry` index
7317-
[ERROR] failed to prepare local package for uploading
7318-
7319-
Caused by:
7320-
no matching package named `foo` found
7321-
location searched: `dummy-registry` index (which is replacing registry `crates-io`)
7322-
required by package `foo v0.0.1 ([ROOT]/foo)`
7315+
[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
73237316
73247317
"#]])
73257318
.run();
7319+
7320+
let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap();
7321+
validate_crate_contents(
7322+
f,
7323+
"foo-0.0.1.crate",
7324+
// no Cargo.lock
7325+
&["Cargo.toml", "Cargo.toml.orig", "src/lib.rs"],
7326+
(),
7327+
);
73267328
}
73277329

73287330
// A failing case from <https://github.com/rust-lang/cargo/issues/15059>
@@ -7359,18 +7361,20 @@ fn unpublished_dependency() {
73597361
.file("src/lib.rs", "")
73607362
.build();
73617363

7362-
p.cargo("package --no-verify -p foo")
7363-
.with_status(101)
7364+
p.cargo("package --no-verify -p foo --exclude-lockfile")
73647365
.with_stderr_data(str![[r#"
73657366
[PACKAGING] foo v0.0.1 ([ROOT]/foo)
7366-
[UPDATING] `dummy-registry` index
7367-
[ERROR] failed to prepare local package for uploading
7368-
7369-
Caused by:
7370-
no matching package named `dep` found
7371-
location searched: `dummy-registry` index (which is replacing registry `crates-io`)
7372-
required by package `foo v0.0.1 ([ROOT]/foo)`
7367+
[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
73737368
73747369
"#]])
73757370
.run();
7371+
7372+
let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap();
7373+
validate_crate_contents(
7374+
f,
7375+
"foo-0.0.1.crate",
7376+
// no Cargo.lock
7377+
&["Cargo.toml", "Cargo.toml.orig", "src/lib.rs"],
7378+
(),
7379+
);
73767380
}

0 commit comments

Comments
 (0)