Skip to content

Commit 1211886

Browse files
committed
fix(test): Remove with_stdout/with_stderr
1 parent dae0e35 commit 1211886

File tree

2 files changed

+4
-30
lines changed

2 files changed

+4
-30
lines changed

crates/cargo-test-support/src/lib.rs

+2-29
Original file line numberDiff line numberDiff line change
@@ -472,9 +472,10 @@ impl Project {
472472
/// # Example:
473473
///
474474
/// ```no_run
475+
/// # use cargo_test_support::str;
475476
/// # let p = cargo_test_support::project().build();
476477
/// p.process(&p.bin("foo"))
477-
/// .with_stdout("bar\n")
478+
/// .with_stdout_data(str!["bar\n"])
478479
/// .run();
479480
/// ```
480481
pub fn process<T: AsRef<OsStr>>(&self, program: T) -> Execs {
@@ -644,9 +645,7 @@ struct RawOutput {
644645
pub struct Execs {
645646
ran: bool,
646647
process_builder: Option<ProcessBuilder>,
647-
expect_stdout: Option<String>,
648648
expect_stdin: Option<String>,
649-
expect_stderr: Option<String>,
650649
expect_exit_code: Option<i32>,
651650
expect_stdout_data: Option<snapbox::Data>,
652651
expect_stderr_data: Option<snapbox::Data>,
@@ -673,22 +672,6 @@ impl Execs {
673672

674673
/// # Configure assertions
675674
impl Execs {
676-
/// Verifies that stdout is equal to the given lines.
677-
/// See [`compare`] for supported patterns.
678-
#[deprecated(note = "replaced with `Execs::with_stdout_data(expected)`")]
679-
pub fn with_stdout<S: ToString>(&mut self, expected: S) -> &mut Self {
680-
self.expect_stdout = Some(expected.to_string());
681-
self
682-
}
683-
684-
/// Verifies that stderr is equal to the given lines.
685-
/// See [`compare`] for supported patterns.
686-
#[deprecated(note = "replaced with `Execs::with_stderr_data(expected)`")]
687-
pub fn with_stderr<S: ToString>(&mut self, expected: S) -> &mut Self {
688-
self.expect_stderr = Some(expected.to_string());
689-
self
690-
}
691-
692675
/// Verifies that stdout is equal to the given lines.
693676
///
694677
/// See [`compare::assert_e2e`] for assertion details.
@@ -1058,9 +1041,7 @@ impl Execs {
10581041
#[track_caller]
10591042
fn verify_checks_output(&self, stdout: &[u8], stderr: &[u8]) {
10601043
if self.expect_exit_code.unwrap_or(0) != 0
1061-
&& self.expect_stdout.is_none()
10621044
&& self.expect_stdin.is_none()
1063-
&& self.expect_stderr.is_none()
10641045
&& self.expect_stdout_data.is_none()
10651046
&& self.expect_stderr_data.is_none()
10661047
&& self.expect_stdout_contains.is_empty()
@@ -1154,12 +1135,6 @@ impl Execs {
11541135
),
11551136
}
11561137

1157-
if let Some(expect_stdout) = &self.expect_stdout {
1158-
compare::match_exact(expect_stdout, stdout, "stdout", stderr, cwd)?;
1159-
}
1160-
if let Some(expect_stderr) = &self.expect_stderr {
1161-
compare::match_exact(expect_stderr, stderr, "stderr", stdout, cwd)?;
1162-
}
11631138
if let Some(expect_stdout_data) = &self.expect_stdout_data {
11641139
if let Err(err) = self.assert.try_eq(
11651140
Some(&"stdout"),
@@ -1227,8 +1202,6 @@ pub fn execs() -> Execs {
12271202
Execs {
12281203
ran: false,
12291204
process_builder: None,
1230-
expect_stdout: None,
1231-
expect_stderr: None,
12321205
expect_stdin: None,
12331206
expect_exit_code: Some(0),
12341207
expect_stdout_data: None,

crates/cargo-test-support/src/registry.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
//! ```no_run
66
//! use cargo_test_support::registry::Package;
77
//! use cargo_test_support::project;
8+
//! use cargo_test_support::str;
89
//!
910
//! // Publish package "a" depending on "b".
1011
//! Package::new("a", "1.0.0")
@@ -38,7 +39,7 @@
3839
//! "#)
3940
//! .build();
4041
//!
41-
//! p.cargo("run").with_stdout("24").run();
42+
//! p.cargo("run").with_stdout_data(str!["24"]).run();
4243
//! ```
4344
4445
use crate::git::repo;

0 commit comments

Comments
 (0)