Skip to content

Commit d602434

Browse files
committed
test: migrate testsuite precise_pre_release to snapbox
1 parent efbcbb0 commit d602434

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

tests/testsuite/precise_pre_release.rs

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//! Tests for selecting pre-release versions with `update --precise`.
22
3-
#![allow(deprecated)]
4-
5-
use cargo_test_support::project;
3+
use cargo_test_support::{project, str};
64

75
#[cargo_test]
86
fn requires_nightly_cargo() {
@@ -29,16 +27,17 @@ fn requires_nightly_cargo() {
2927
.with_status(101)
3028
// This error is suffering from #12579 but still demonstrates that updating to
3129
// a pre-release does not work on stable
32-
.with_stderr(
33-
r#"[UPDATING] `dummy-registry` index
30+
.with_stderr_data(str![[r#"
31+
[UPDATING] `dummy-registry` index
3432
[ERROR] failed to select a version for the requirement `my-dependency = "^0.1.1"`
3533
candidate versions found which didn't match: 0.1.2-pre.0
3634
location searched: `dummy-registry` index (which is replacing registry `crates-io`)
3735
required by package `package v0.0.0 ([ROOT]/foo)`
3836
if you are looking for the prerelease package it needs to be specified explicitly
3937
my-dependency = { version = "0.1.2-pre.0" }
40-
perhaps a crate was updated and forgotten to be re-vendored?"#,
41-
)
38+
perhaps a crate was updated and forgotten to be re-vendored?
39+
40+
"#]])
4241
.run()
4342
}
4443

@@ -65,11 +64,11 @@ fn update_pre_release() {
6564

6665
p.cargo("update my-dependency --precise 0.1.2-pre.0 -Zunstable-options")
6766
.masquerade_as_nightly_cargo(&["precise-pre-release"])
68-
.with_stderr(
69-
r#"[UPDATING] `dummy-registry` index
67+
.with_stderr_data(str![[r#"
68+
[UPDATING] `dummy-registry` index
7069
[UPDATING] my-dependency v0.1.1 -> v0.1.2-pre.0
71-
"#,
72-
)
70+
71+
"#]])
7372
.run();
7473
let lockfile = p.read_lockfile();
7574
assert!(lockfile.contains("\nname = \"my-dependency\"\nversion = \"0.1.2-pre.0\""));
@@ -98,20 +97,20 @@ fn update_pre_release_differ() {
9897

9998
p.cargo("update -p my-dependency --precise 0.1.2-pre.0 -Zunstable-options")
10099
.masquerade_as_nightly_cargo(&["precise-pre-release"])
101-
.with_stderr(
102-
r#"[UPDATING] `dummy-registry` index
100+
.with_stderr_data(str![[r#"
101+
[UPDATING] `dummy-registry` index
103102
[DOWNGRADING] my-dependency v0.1.2 -> v0.1.2-pre.0
104-
"#,
105-
)
103+
104+
"#]])
106105
.run();
107106

108107
p.cargo("update -p my-dependency --precise 0.1.2-pre.1 -Zunstable-options")
109108
.masquerade_as_nightly_cargo(&["precise-pre-release"])
110-
.with_stderr(
111-
r#"[UPDATING] `dummy-registry` index
109+
.with_stderr_data(str![[r#"
110+
[UPDATING] `dummy-registry` index
112111
[UPDATING] my-dependency v0.1.2-pre.0 -> v0.1.2-pre.1
113-
"#,
114-
)
112+
113+
"#]])
115114
.run();
116115

117116
let lockfile = p.read_lockfile();

0 commit comments

Comments
 (0)