Skip to content

Commit b2b026b

Browse files
committed
Improve testcase include_files_called_target_git
1 parent 722d8f1 commit b2b026b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

tests/testsuite/package.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3162,10 +3162,10 @@ src/main.rs
31623162
fn include_files_called_target_git() {
31633163
// https://github.com/rust-lang/cargo/issues/12790
31643164
// files and folders called "target" should be included, unless they're the actual target directory
3165-
let (p, repo) = git::new_repo("target_uncommitted", |p| init_and_add_inner_target(p));
3165+
let (p, repo) = git::new_repo("foo", |p| init_and_add_inner_target(p));
31663166
// add target folder but not committed.
3167-
let _ = fs::create_dir_all(&repo.workdir().unwrap().join("target/foo.txt")).unwrap();
3168-
3167+
_ = fs::create_dir(p.build_dir()).unwrap();
3168+
_ = fs::write(p.build_dir().join("foo.txt"), "").unwrap();
31693169
p.cargo("package -l")
31703170
.with_stdout(
31713171
"\
@@ -3183,9 +3183,8 @@ src/main.rs
31833183
.run();
31843184

31853185
// if target is committed, it should be include.
3186-
let p = git::new("target_committed", |p| {
3187-
init_and_add_inner_target(p).file("target/foo.txt", "")
3188-
});
3186+
git::add(&repo);
3187+
git::commit(&repo);
31893188
p.cargo("package -l")
31903189
.with_stdout(
31913190
"\

0 commit comments

Comments
 (0)