mirror of
https://github.com/uutils/coreutils
synced 2024-10-04 14:59:20 +00:00
Minor cleanup
- Removes compiler warnings. - Renames conv=nocreat test to be more descriptive.
This commit is contained in:
parent
9c38583c6b
commit
5b030b4855
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1918,7 +1918,6 @@ dependencies = [
|
|||
"debug_print",
|
||||
"gcd",
|
||||
"libc",
|
||||
"rand 0.8.4",
|
||||
"signal-hook",
|
||||
"tempfile",
|
||||
"uucore",
|
||||
|
|
|
@ -25,7 +25,6 @@ uucore = { version=">=0.0.7", package="uucore", path="../../uucore" }
|
|||
uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" }
|
||||
|
||||
[dev-dependencies]
|
||||
rand = "0.8"
|
||||
tempfile = "^3"
|
||||
|
||||
[[bin]]
|
||||
|
|
|
@ -5,7 +5,6 @@ mod conversion_tests;
|
|||
mod block_unblock_tests;
|
||||
mod conv_sync_tests;
|
||||
|
||||
use rand::prelude::*;
|
||||
use std::io::prelude::*;
|
||||
use std::io::BufReader;
|
||||
use std::fs;
|
||||
|
@ -70,26 +69,6 @@ impl<R: Read> Read for LazyReader<R>
|
|||
}
|
||||
}
|
||||
|
||||
struct FickleReader<R: Read>
|
||||
{
|
||||
src: R,
|
||||
}
|
||||
|
||||
impl<R: Read> Read for FickleReader<R>
|
||||
{
|
||||
fn read(&mut self, mut buf: &mut [u8]) -> io::Result<usize>
|
||||
{
|
||||
if rand::random()
|
||||
{
|
||||
self.src.read(&mut buf)
|
||||
}
|
||||
else
|
||||
{
|
||||
Ok(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! icf (
|
||||
() =>
|
||||
|
|
|
@ -252,46 +252,6 @@ make_io_test!(
|
|||
File::open("./test-resources/random-5828891cb1230748e146f34223bbd3b5.test").unwrap()
|
||||
);
|
||||
|
||||
make_io_test!(
|
||||
random_73k_test_fickle_fullblock,
|
||||
"random-73k-test-fickle-fullblock",
|
||||
Input {
|
||||
src: FickleReader {
|
||||
src: File::open("./test-resources/random-5828891cb1230748e146f34223bbd3b5.test").unwrap()
|
||||
},
|
||||
non_ascii: false,
|
||||
ibs: 521,
|
||||
xfer_stats: None,
|
||||
count: None,
|
||||
cflags: icf!(),
|
||||
iflags: IFlags {
|
||||
fullblock: true,
|
||||
cio: false,
|
||||
direct: false,
|
||||
directory: false,
|
||||
dsync: false,
|
||||
sync: false,
|
||||
nocache: false,
|
||||
nonblock: false,
|
||||
noatime: false,
|
||||
noctty: false,
|
||||
nofollow: false,
|
||||
nolinks: false,
|
||||
binary: false,
|
||||
text: false,
|
||||
count_bytes: false,
|
||||
skip_bytes: false,
|
||||
},
|
||||
},
|
||||
Output {
|
||||
dst: DST_PLACEHOLDER,
|
||||
obs: 1031,
|
||||
cflags: DEFAULT_CFO,
|
||||
oflags: DEFAULT_OFLAGS,
|
||||
},
|
||||
File::open("./test-resources/random-5828891cb1230748e146f34223bbd3b5.test").unwrap()
|
||||
);
|
||||
|
||||
// Test internal buffer size fn
|
||||
#[test]
|
||||
fn bsize_test_primes()
|
||||
|
|
|
@ -2,7 +2,6 @@ use super::*;
|
|||
|
||||
use crate::{
|
||||
build_dd_app,
|
||||
IConvFlags, OConvFlags,
|
||||
StatusLevel,
|
||||
};
|
||||
|
||||
|
@ -82,7 +81,7 @@ fn icf_ctable_error()
|
|||
|
||||
let matches = build_dd_app!().get_matches_from_safe(args).unwrap();
|
||||
|
||||
let icf_parsed = parse_conv_flag_input(&matches).unwrap();
|
||||
let _ = parse_conv_flag_input(&matches).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -96,7 +95,7 @@ fn icf_case_error()
|
|||
|
||||
let matches = build_dd_app!().get_matches_from_safe(args).unwrap();
|
||||
|
||||
let icf_parsed = parse_conv_flag_input(&matches).unwrap();
|
||||
let _ = parse_conv_flag_input(&matches).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -110,7 +109,7 @@ fn icf_block_error()
|
|||
|
||||
let matches = build_dd_app!().get_matches_from_safe(args).unwrap();
|
||||
|
||||
let icf_parsed = parse_conv_flag_input(&matches).unwrap();
|
||||
let _ = parse_conv_flag_input(&matches).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -124,7 +123,7 @@ fn icf_creat_error()
|
|||
|
||||
let matches = build_dd_app!().get_matches_from_safe(args).unwrap();
|
||||
|
||||
let icf_parsed = parse_conv_flag_output(&matches).unwrap();
|
||||
let _ = parse_conv_flag_output(&matches).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -92,14 +92,6 @@ fn build_ascii_block(n: usize) -> Vec<u8>
|
|||
.collect()
|
||||
}
|
||||
|
||||
fn build_ebcdic_block(n: usize) -> Vec<u8>
|
||||
{
|
||||
(0..=255)
|
||||
.cycle()
|
||||
.take(n)
|
||||
.collect()
|
||||
}
|
||||
|
||||
// Sanity Tests
|
||||
#[test]
|
||||
fn version()
|
||||
|
@ -357,7 +349,7 @@ fn test_noatime_does_not_update_ofile_atime()
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_nocreat_causes_failure_when_not_present()
|
||||
fn test_nocreat_causes_failure_when_outfile_not_present()
|
||||
{
|
||||
let fname = "this-file-does-not-exist.txt";
|
||||
assert_fixture_not_exists!(&fname);
|
||||
|
@ -367,6 +359,7 @@ fn test_nocreat_causes_failure_when_not_present()
|
|||
"conv=nocreat",
|
||||
of!(&fname),
|
||||
])
|
||||
.pipe_in("")
|
||||
.run();
|
||||
|
||||
assert!(!fix.file_exists(&fname));
|
||||
|
|
Loading…
Reference in a new issue