Skip to content

Commit fc768ca

Browse files
committed
test(cli-self-upd): migrate to .expect() APIs
1 parent 02c34f3 commit fc768ca

File tree

3 files changed

+473
-334
lines changed

3 files changed

+473
-334
lines changed

src/test/clitools.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! A mock distribution server used by tests/cli-v1.rs and
22
//! tests/cli-v2.rs
33
use std::{
4+
borrow::Cow,
45
cell::RefCell,
56
collections::HashMap,
67
env::{self, consts::EXE_SUFFIX},
@@ -32,6 +33,7 @@ use crate::test::this_host_triple;
3233
use crate::utils;
3334

3435
use super::{
36+
CROSS_ARCH1, CROSS_ARCH2,
3537
dist::{MockDistServer, MockManifestVersion, Release, RlsStatus, change_channel_date},
3638
mock::MockFile,
3739
};
@@ -74,7 +76,15 @@ impl Assert {
7476
pub fn new(output: SanitizedOutput) -> Self {
7577
let mut redactions = Redactions::new();
7678
redactions
77-
.extend([("[HOST_TRIPLE]", this_host_triple())])
79+
.extend([
80+
(
81+
"[CURRENT_VERSION]",
82+
Cow::Borrowed(env!("CARGO_PKG_VERSION")),
83+
),
84+
("[HOST_TRIPLE]", Cow::Owned(this_host_triple())),
85+
("[CROSS_ARCH_I]", Cow::Borrowed(CROSS_ARCH1)),
86+
("[CROSS_ARCH_II]", Cow::Borrowed(CROSS_ARCH2)),
87+
])
7888
.expect("invalid redactions detected");
7989
Self { output, redactions }
8090
}

tests/suite/cli_exact.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,9 @@ async fn check_updates_self_no_change() {
237237
cx.config
238238
.expect(["rustup", "check"])
239239
.await
240-
.extend_redactions([("[VERSION]", current_version)])
241240
.is_err()
242241
.with_stdout(snapbox::str![[r#"
243-
rustup - Up to date : [VERSION]
242+
rustup - Up to date : [CURRENT_VERSION]
244243
245244
"#]]);
246245
}

0 commit comments

Comments
 (0)