Skip to content

Commit b78ff0b

Browse files
committed
chore(test): deprecated old APIs overlapping with the new ones
1 parent ac32336 commit b78ff0b

File tree

9 files changed

+33
-0
lines changed

9 files changed

+33
-0
lines changed

src/test/clitools.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,14 @@ impl Config {
231231
}
232232

233233
/// Expect an ok status
234+
#[deprecated(note = "use `.expect().await.is_ok()` instead")]
235+
#[allow(deprecated)]
234236
pub async fn expect_ok(&mut self, args: &[&str]) {
235237
self.expect_ok_env(args, &[]).await
236238
}
237239

238240
/// Expect an ok status with extra environment variables
241+
#[deprecated(note = "use `.expect_with_env().await.is_ok()` instead")]
239242
pub async fn expect_ok_env(&self, args: &[&str], env: &[(&str, &str)]) {
240243
let out = self.run(args[0], &args[1..], env).await;
241244
if !out.ok {
@@ -246,11 +249,14 @@ impl Config {
246249
}
247250

248251
/// Expect an err status and a string in stderr
252+
#[deprecated(note = "use `.expect().await.is_err()` instead")]
253+
#[allow(deprecated)]
249254
pub async fn expect_err(&self, args: &[&str], expected: &str) {
250255
self.expect_err_env(args, &[], expected).await
251256
}
252257

253258
/// Expect an err status and a string in stderr, with extra environment variables
259+
#[deprecated(note = "use `.expect_with_env().await.is_err()` instead")]
254260
pub async fn expect_err_env(&self, args: &[&str], env: &[(&str, &str)], expected: &str) {
255261
let out = self.run(args[0], &args[1..], env).await;
256262
if out.ok || !out.stderr.contains(expected) {
@@ -262,6 +268,7 @@ impl Config {
262268
}
263269

264270
/// Expect an ok status and a string in stdout
271+
#[deprecated(note = "use `.expect().await.is_ok().with_stdout()` instead")]
265272
pub async fn expect_stdout_ok(&self, args: &[&str], expected: &str) {
266273
let out = self.run(args[0], &args[1..], &[]).await;
267274
if !out.ok || !out.stdout.contains(expected) {
@@ -272,6 +279,7 @@ impl Config {
272279
}
273280
}
274281

282+
#[deprecated(note = "use `.expect().await.is_ok().without_stdout()` instead")]
275283
pub async fn expect_not_stdout_ok(&self, args: &[&str], expected: &str) {
276284
let out = self.run(args[0], &args[1..], &[]).await;
277285
if !out.ok || out.stdout.contains(expected) {
@@ -282,6 +290,7 @@ impl Config {
282290
}
283291
}
284292

293+
#[deprecated(note = "use `.expect().await.is_ok().without_stderr()` instead")]
285294
pub async fn expect_not_stderr_ok(&self, args: &[&str], expected: &str) {
286295
let out = self.run(args[0], &args[1..], &[]).await;
287296
if !out.ok || out.stderr.contains(expected) {
@@ -292,6 +301,7 @@ impl Config {
292301
}
293302
}
294303

304+
#[deprecated(note = "use `.expect().await.is_err().without_stderr()` instead")]
295305
pub async fn expect_not_stderr_err(&self, args: &[&str], expected: &str) {
296306
let out = self.run(args[0], &args[1..], &[]).await;
297307
if out.ok || out.stderr.contains(expected) {
@@ -303,6 +313,7 @@ impl Config {
303313
}
304314

305315
/// Expect an ok status and a string in stderr
316+
#[deprecated(note = "use `.expect().await.is_ok().with_stderr()` instead")]
306317
pub async fn expect_stderr_ok(&self, args: &[&str], expected: &str) {
307318
let out = self.run(args[0], &args[1..], &[]).await;
308319
if !out.ok || !out.stderr.contains(expected) {
@@ -314,12 +325,17 @@ impl Config {
314325
}
315326

316327
/// Expect an exact strings on stdout/stderr with an ok status code
328+
#[deprecated(note = "use `.expect().await.is_ok().with_stdout().with_stderr()` instead")]
329+
#[allow(deprecated)]
317330
pub async fn expect_ok_ex(&mut self, args: &[&str], stdout: &str, stderr: &str) {
318331
self.expect_ok_ex_env(args, &[], stdout, stderr).await;
319332
}
320333

321334
/// Expect an exact strings on stdout/stderr with an ok status code,
322335
/// with extra environment variables
336+
#[deprecated(
337+
note = "use `.expect_with_env().await.is_ok().with_stdout().with_stderr()` instead"
338+
)]
323339
pub async fn expect_ok_ex_env(
324340
&mut self,
325341
args: &[&str],
@@ -342,6 +358,7 @@ impl Config {
342358
}
343359

344360
/// Expect an exact strings on stdout/stderr with an error status code
361+
#[deprecated(note = "use `.expect().await.is_err().with_stdout().with_stderr()` instead")]
345362
pub async fn expect_err_ex(&self, args: &[&str], stdout: &str, stderr: &str) {
346363
let out = self.run(args[0], &args[1..], &[]).await;
347364
if out.ok || out.stdout != stdout || out.stderr != stderr {

tests/suite/cli_exact.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
//! Yet more cli test cases. These are testing that the output
22
//! is exactly as expected.
33
4+
#![allow(deprecated)]
5+
46
use rustup::for_host;
57
use rustup::test::{
68
CROSS_ARCH1, CROSS_ARCH2, CliTestContext, MULTI_ARCH1, Scenario, this_host_triple,

tests/suite/cli_inst_interactive.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! Tests of the interactive console installer
22
3+
#![allow(deprecated)]
4+
35
use std::env::consts::EXE_SUFFIX;
46
use std::io::Write;
57
use std::process::Stdio;

tests/suite/cli_misc.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
//! Test cases of the rustup command that do not depend on the
22
//! dist server, mostly derived from multirust/test-v2.sh
33
4+
#![allow(deprecated)]
5+
46
use std::fs;
57
use std::str;
68
use std::{env::consts::EXE_SUFFIX, path::Path};

tests/suite/cli_paths.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
//! It depends on self-update working, so if absolutely everything here breaks,
33
//! check those tests as well.
44
5+
#![allow(deprecated)]
6+
57
// Prefer omitting actually unpacking content while just testing paths.
68
const INIT_NONE: [&str; 4] = ["rustup-init", "-y", "--default-toolchain", "none"];
79

tests/suite/cli_rustup.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! Test cases for new rustup UI
22
3+
#![allow(deprecated)]
4+
35
use std::fs;
46
use std::path::{MAIN_SEPARATOR, PathBuf};
57
use std::{env::consts::EXE_SUFFIX, path::Path};

tests/suite/cli_self_upd.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! Testing self install, uninstall and update
22
3+
#![allow(deprecated)]
4+
35
use std::env;
46
use std::env::consts::EXE_SUFFIX;
57
use std::fs;

tests/suite/cli_v1.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
//! Test cases of the rustup command, using v1 manifests, mostly
22
//! derived from multirust/test-v2.sh
33
4+
#![allow(deprecated)]
5+
46
use std::fs;
57

68
use rustup::for_host;

tests/suite/cli_v2.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
//! Test cases of the rustup command, using v2 manifests, mostly
22
//! derived from multirust/test-v2.sh
33
4+
#![allow(deprecated)]
5+
46
use std::fs;
57
use std::io::Write;
68
use std::path::PathBuf;

0 commit comments

Comments
 (0)