Skip to content

Commit 7947398

Browse files
committed
test(package): show symlink to submodule failed the check
1 parent c7be060 commit 7947398

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

tests/testsuite/package.rs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,6 +1425,56 @@ edition = "2021"
14251425
);
14261426
}
14271427

1428+
#[cargo_test]
1429+
fn dirty_file_outside_pkg_root_inside_submodule() {
1430+
if !symlink_supported() {
1431+
return;
1432+
}
1433+
let (p, repo) = git::new_repo("foo", |p| {
1434+
p.file(
1435+
"Cargo.toml",
1436+
r#"
1437+
[workspace]
1438+
members = ["isengard"]
1439+
resolver = "2"
1440+
"#,
1441+
)
1442+
.file(
1443+
"isengard/Cargo.toml",
1444+
r#"
1445+
[package]
1446+
name = "isengard"
1447+
edition = "2015"
1448+
homepage = "saruman"
1449+
description = "saruman"
1450+
license = "ISC"
1451+
"#,
1452+
)
1453+
.file("isengard/src/lib.rs", "")
1454+
});
1455+
let submodule = git::new("submodule", |p| {
1456+
p.no_manifest().file("file.txt", "from-submodule")
1457+
});
1458+
git::add_submodule(
1459+
&repo,
1460+
&submodule.root().to_url().to_string(),
1461+
Path::new("submodule"),
1462+
);
1463+
p.symlink("submodule/file.txt", "isengard/src/file.txt");
1464+
git::add(&repo);
1465+
git::commit(&repo);
1466+
// This dirtyness should be detected in the future.
1467+
p.change_file("submodule/file.txt", "changed");
1468+
1469+
p.cargo("package --workspace --no-verify")
1470+
.with_status(101)
1471+
.with_stderr_data(str![[r#"
1472+
[ERROR] attempt to get status of nonexistent file 'submodule/file.txt'; class=Invalid (3); code=NotFound (-3)
1473+
1474+
"#]])
1475+
.run();
1476+
}
1477+
14281478
#[cargo_test]
14291479
fn issue_13695_allow_dirty_vcs_info() {
14301480
let p = project()

0 commit comments

Comments
 (0)