Skip to content

Commit

Permalink
Use snapshots instead of matching on parts of the output
Browse files Browse the repository at this point in the history
Personally I liked that the test was only dependent on what really matters, the lack of presence of a particular filename. Now the test would fail if Cargo one day adds more (generated) files to the package.

Co-authored-by: Weihang Lo <[email protected]>
  • Loading branch information
Byron and weihanglo authored Dec 24, 2024
1 parent 2c3f8d8 commit af92c44
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
9 changes: 8 additions & 1 deletion tests/testsuite/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4249,6 +4249,13 @@ fn simple_with_fifo() {
// would also be read eventually.
git_project
.cargo("package -l")
.with_stdout_does_not_contain("blocks-when-read")
.with_stdout_data(str![[r#"
.cargo_vcs_info.json
Cargo.lock
Cargo.toml
Cargo.toml.orig
src/main.rs
"#]])
.run();
}
8 changes: 7 additions & 1 deletion tests/testsuite/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6899,6 +6899,12 @@ fn simple_with_fifo() {
// Avoid actual blocking even in case of failure, assuming that what it lists here
// would also be read eventually.
p.cargo("package -l")
.with_stdout_does_not_contain("blocks-when-read")
.with_stdout_data(str![[r#"
Cargo.lock
Cargo.toml
Cargo.toml.orig
src/main.rs
"#]])
.run();
}

0 comments on commit af92c44

Please sign in to comment.