mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
simplify some boolean operations
This commit is contained in:
parent
f2074140ec
commit
191e29f951
2 changed files with 5 additions and 5 deletions
|
@ -37,7 +37,7 @@ fn test_file() {
|
|||
let mut f = File::create(&file).unwrap();
|
||||
// spell-checker:disable-next-line
|
||||
assert!(
|
||||
!f.write_all(b"abcdefghijklmnopqrstuvwxyz\n").is_err(),
|
||||
f.write_all(b"abcdefghijklmnopqrstuvwxyz\n").is_ok(),
|
||||
"Test setup failed - could not write file"
|
||||
);
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ fn test_2files() {
|
|||
for &(path, data) in &[(&file1, "abcdefghijklmnop"), (&file2, "qrstuvwxyz\n")] {
|
||||
let mut f = File::create(&path).unwrap();
|
||||
assert!(
|
||||
!f.write_all(data.as_bytes()).is_err(),
|
||||
f.write_all(data.as_bytes()).is_ok(),
|
||||
"Test setup failed - could not write file"
|
||||
);
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ fn test_from_mixed() {
|
|||
for &(path, data) in &[(&file1, data1), (&file3, data3)] {
|
||||
let mut f = File::create(&path).unwrap();
|
||||
assert!(
|
||||
!f.write_all(data.as_bytes()).is_err(),
|
||||
f.write_all(data.as_bytes()).is_ok(),
|
||||
"Test setup failed - could not write file"
|
||||
);
|
||||
}
|
||||
|
|
|
@ -982,7 +982,7 @@ impl UCommand {
|
|||
/// provides standard input to feed in to the command when spawned
|
||||
pub fn pipe_in<T: Into<Vec<u8>>>(&mut self, input: T) -> &mut UCommand {
|
||||
assert!(
|
||||
!self.bytes_into_stdin.is_some(),
|
||||
self.bytes_into_stdin.is_none(),
|
||||
"{}",
|
||||
MULTIPLE_STDIN_MEANINGLESS
|
||||
);
|
||||
|
@ -1000,7 +1000,7 @@ impl UCommand {
|
|||
/// This is typically useful to test non-standard workflows
|
||||
/// like feeding something to a command that does not read it
|
||||
pub fn ignore_stdin_write_error(&mut self) -> &mut UCommand {
|
||||
assert!(!self.bytes_into_stdin.is_none(), "{}", NO_STDIN_MEANINGLESS);
|
||||
assert!(self.bytes_into_stdin.is_some(), "{}", NO_STDIN_MEANINGLESS);
|
||||
self.ignore_stdin_write_error = true;
|
||||
self
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue