Skip to content

Commit af92c44

Browse files
Byronweihanglo
andauthored
Use snapshots instead of matching on parts of the output
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 <weihanglo@users.noreply.github.com>
1 parent 2c3f8d8 commit af92c44

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

tests/testsuite/git.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4249,6 +4249,13 @@ fn simple_with_fifo() {
42494249
// would also be read eventually.
42504250
git_project
42514251
.cargo("package -l")
4252-
.with_stdout_does_not_contain("blocks-when-read")
4252+
.with_stdout_data(str![[r#"
4253+
.cargo_vcs_info.json
4254+
Cargo.lock
4255+
Cargo.toml
4256+
Cargo.toml.orig
4257+
src/main.rs
4258+
4259+
"#]])
42534260
.run();
42544261
}

tests/testsuite/package.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6899,6 +6899,12 @@ fn simple_with_fifo() {
68996899
// Avoid actual blocking even in case of failure, assuming that what it lists here
69006900
// would also be read eventually.
69016901
p.cargo("package -l")
6902-
.with_stdout_does_not_contain("blocks-when-read")
6902+
.with_stdout_data(str![[r#"
6903+
Cargo.lock
6904+
Cargo.toml
6905+
Cargo.toml.orig
6906+
src/main.rs
6907+
6908+
"#]])
69036909
.run();
69046910
}

0 commit comments

Comments
 (0)