mirror of
https://github.com/uutils/coreutils
synced 2024-12-18 17:14:42 +00:00
Merge pull request #920 from nathanross/tests-common-util-idiomatic-asserts
tests/common: use more idiomatic asserts
This commit is contained in:
commit
94b3d8a992
1 changed files with 5 additions and 5 deletions
|
@ -65,7 +65,7 @@ impl CmdResult {
|
|||
/// 1. you can not know exactly what stdout will be
|
||||
/// or 2. you know that stdout will also be empty
|
||||
pub fn no_stderr(&self) -> Box<&CmdResult> {
|
||||
assert!(self.stderr.len() == 0);
|
||||
assert_eq!(0, self.stderr.len());
|
||||
Box::new(self)
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ impl CmdResult {
|
|||
/// 1. you can not know exactly what stderr will be
|
||||
/// or 2. you know that stderr will also be empty
|
||||
pub fn no_stdout(&self) -> Box<&CmdResult> {
|
||||
assert!(self.stdout.len() == 0);
|
||||
assert_eq!(0, self.stdout.len());
|
||||
Box::new(self)
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ impl CmdResult {
|
|||
/// passed in value, when both are trimmed of trailing whitespace
|
||||
/// stdout_only is a better choice unless stderr may or will be non-empty
|
||||
pub fn stdout_is<T: AsRef<str>>(&self, msg: T) -> Box<&CmdResult> {
|
||||
assert!(self.stdout.trim_right() == String::from(msg.as_ref()).trim_right());
|
||||
assert_eq!(String::from(msg.as_ref()).trim_right(), self.stdout.trim_right());
|
||||
Box::new(self)
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ impl CmdResult {
|
|||
/// passed in value, when both are trimmed of trailing whitespace
|
||||
/// stderr_only is a better choice unless stdout may or will be non-empty
|
||||
pub fn stderr_is<T: AsRef<str>>(&self, msg: T) -> Box<&CmdResult> {
|
||||
assert!(self.stderr.trim_right() == String::from(msg.as_ref()).trim_right());
|
||||
assert_eq!(String::from(msg.as_ref()).trim_right(), self.stderr.trim_right());
|
||||
Box::new(self)
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ impl CmdResult {
|
|||
|
||||
pub fn fails_silently(&self) -> Box<&CmdResult> {
|
||||
assert!(!self.success);
|
||||
assert!(self.stderr.len() == 0);
|
||||
assert_eq!(0, self.stderr.len());
|
||||
Box::new(self)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue