mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
tests/util: Improve assertion messages of CmdResult::stderr_is_bytes
, stdout_is_bytes
This commit is contained in:
parent
1fadeb43b2
commit
78a381032b
1 changed files with 12 additions and 2 deletions
|
@ -474,7 +474,11 @@ impl CmdResult {
|
|||
/// whose bytes equal those of the passed in slice
|
||||
#[track_caller]
|
||||
pub fn stdout_is_bytes<T: AsRef<[u8]>>(&self, msg: T) -> &Self {
|
||||
assert_eq!(self.stdout, msg.as_ref());
|
||||
assert_eq!(self.stdout, msg.as_ref(),
|
||||
"stdout as bytes wasn't equal to expected bytes. Result as strings:\nstdout ='{:?}'\nexpected='{:?}'",
|
||||
std::str::from_utf8(&self.stdout),
|
||||
std::str::from_utf8(msg.as_ref()),
|
||||
);
|
||||
self
|
||||
}
|
||||
|
||||
|
@ -555,7 +559,13 @@ impl CmdResult {
|
|||
/// whose bytes equal those of the passed in slice
|
||||
#[track_caller]
|
||||
pub fn stderr_is_bytes<T: AsRef<[u8]>>(&self, msg: T) -> &Self {
|
||||
assert_eq!(self.stderr, msg.as_ref());
|
||||
assert_eq!(
|
||||
&self.stderr,
|
||||
msg.as_ref(),
|
||||
"stderr as bytes wasn't equal to expected bytes. Result as strings:\nstderr ='{:?}'\nexpected='{:?}'",
|
||||
std::str::from_utf8(&self.stderr),
|
||||
std::str::from_utf8(msg.as_ref())
|
||||
);
|
||||
self
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue