diff --git a/crates/snapbox/src/assert.rs b/crates/snapbox/src/assert.rs index bf60cd70..152ba22e 100644 --- a/crates/snapbox/src/assert.rs +++ b/crates/snapbox/src/assert.rs @@ -7,6 +7,7 @@ use std::io::stderr; use crate::filters::{Filter as _, FilterNewlines, FilterPaths, FilterRedactions}; use crate::Action; +use crate::IntoData; /// Snapshot assertion against a file's contents /// @@ -61,9 +62,9 @@ impl Assert { /// Assert::new().eq(file!["output.txt"], actual); /// ``` #[track_caller] - pub fn eq(&self, expected: impl Into, actual: impl Into) { - let expected = expected.into(); - let actual = actual.into(); + pub fn eq(&self, expected: impl IntoData, actual: impl IntoData) { + let expected = expected.into_data(); + let actual = actual.into_data(); if let Err(err) = self.try_eq(expected, actual, Some(&"In-memory")) { err.panic(); } diff --git a/crates/snapbox/src/cmd.rs b/crates/snapbox/src/cmd.rs index 1df82fbb..5dd669da 100644 --- a/crates/snapbox/src/cmd.rs +++ b/crates/snapbox/src/cmd.rs @@ -3,6 +3,8 @@ #[cfg(feature = "color")] use anstream::panic; +use crate::IntoData; + /// Process spawning for testing of non-interactive commands #[derive(Debug)] pub struct Command { @@ -243,8 +245,8 @@ impl Command { /// .assert() /// .stdout_eq("42"); /// ``` - pub fn stdin(mut self, stream: impl Into) -> Self { - self.stdin = Some(stream.into()); + pub fn stdin(mut self, stream: impl IntoData) -> Self { + self.stdin = Some(stream.into_data()); self } @@ -621,8 +623,8 @@ impl OutputAssert { /// .stdout_eq(file!["stdout.log"]); /// ``` #[track_caller] - pub fn stdout_eq(self, expected: impl Into) -> Self { - let expected = expected.into(); + pub fn stdout_eq(self, expected: impl IntoData) -> Self { + let expected = expected.into_data(); self.stdout_eq_inner(expected) } @@ -671,8 +673,8 @@ impl OutputAssert { /// .stderr_eq(file!["stderr.log"]); /// ``` #[track_caller] - pub fn stderr_eq(self, expected: impl Into) -> Self { - let expected = expected.into(); + pub fn stderr_eq(self, expected: impl IntoData) -> Self { + let expected = expected.into_data(); self.stderr_eq_inner(expected) } diff --git a/crates/snapbox/src/lib.rs b/crates/snapbox/src/lib.rs index 21340b87..ef6f6ce8 100644 --- a/crates/snapbox/src/lib.rs +++ b/crates/snapbox/src/lib.rs @@ -152,7 +152,7 @@ pub mod prelude { /// assert_eq(file!["output.txt"], actual); /// ``` #[track_caller] -pub fn assert_eq(expected: impl Into, actual: impl Into) { +pub fn assert_eq(expected: impl IntoData, actual: impl IntoData) { Assert::new() .action_env(DEFAULT_ACTION_ENV) .eq(expected, actual);