mirror of
https://github.com/uutils/coreutils
synced 2024-11-17 10:18:11 +00:00
Merge pull request #2048 from tertsdiepraam/ls/refacter_tests
ls: refactor tests
This commit is contained in:
commit
0f71bf9c33
2 changed files with 334 additions and 408 deletions
File diff suppressed because it is too large
Load diff
|
@ -165,8 +165,8 @@ impl CmdResult {
|
||||||
/// asserts that the command resulted in empty (zero-length) stderr stream output
|
/// asserts that the command resulted in empty (zero-length) stderr stream output
|
||||||
/// generally, it's better to use stdout_only() instead,
|
/// generally, it's better to use stdout_only() instead,
|
||||||
/// but you might find yourself using this function if
|
/// but you might find yourself using this function if
|
||||||
/// 1. you can not know exactly what stdout will be
|
/// 1. you can not know exactly what stdout will be or
|
||||||
/// or 2. you know that stdout will also be empty
|
/// 2. you know that stdout will also be empty
|
||||||
pub fn no_stderr(&self) -> &CmdResult {
|
pub fn no_stderr(&self) -> &CmdResult {
|
||||||
assert!(self.stderr.is_empty());
|
assert!(self.stderr.is_empty());
|
||||||
self
|
self
|
||||||
|
@ -176,8 +176,8 @@ impl CmdResult {
|
||||||
/// unless asserting there was neither stdout or stderr, stderr_only is usually a better choice
|
/// unless asserting there was neither stdout or stderr, stderr_only is usually a better choice
|
||||||
/// generally, it's better to use stderr_only() instead,
|
/// generally, it's better to use stderr_only() instead,
|
||||||
/// but you might find yourself using this function if
|
/// but you might find yourself using this function if
|
||||||
/// 1. you can not know exactly what stderr will be
|
/// 1. you can not know exactly what stderr will be or
|
||||||
/// or 2. you know that stderr will also be empty
|
/// 2. you know that stderr will also be empty
|
||||||
pub fn no_stdout(&self) -> &CmdResult {
|
pub fn no_stdout(&self) -> &CmdResult {
|
||||||
assert!(self.stdout.is_empty());
|
assert!(self.stdout.is_empty());
|
||||||
self
|
self
|
||||||
|
@ -224,8 +224,8 @@ impl CmdResult {
|
||||||
|
|
||||||
/// asserts that
|
/// asserts that
|
||||||
/// 1. the command resulted in stdout stream output that equals the
|
/// 1. the command resulted in stdout stream output that equals the
|
||||||
/// passed in value, when both are trimmed of trailing whitespace
|
/// passed in value
|
||||||
/// and 2. the command resulted in empty (zero-length) stderr stream output
|
/// 2. the command resulted in empty (zero-length) stderr stream output
|
||||||
pub fn stdout_only<T: AsRef<str>>(&self, msg: T) -> &CmdResult {
|
pub fn stdout_only<T: AsRef<str>>(&self, msg: T) -> &CmdResult {
|
||||||
self.no_stderr().stdout_is(msg)
|
self.no_stderr().stdout_is(msg)
|
||||||
}
|
}
|
||||||
|
@ -247,7 +247,7 @@ impl CmdResult {
|
||||||
/// asserts that
|
/// asserts that
|
||||||
/// 1. the command resulted in stderr stream output that equals the
|
/// 1. the command resulted in stderr stream output that equals the
|
||||||
/// passed in value, when both are trimmed of trailing whitespace
|
/// passed in value, when both are trimmed of trailing whitespace
|
||||||
/// and 2. the command resulted in empty (zero-length) stdout stream output
|
/// 2. the command resulted in empty (zero-length) stdout stream output
|
||||||
pub fn stderr_only<T: AsRef<str>>(&self, msg: T) -> &CmdResult {
|
pub fn stderr_only<T: AsRef<str>>(&self, msg: T) -> &CmdResult {
|
||||||
self.no_stdout().stderr_is(msg)
|
self.no_stdout().stderr_is(msg)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue