mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 19:47:45 +00:00
Minor cleanup
- Removes compiler warnings. - Renames conv=nocreat test to be more descriptive.
This commit is contained in:
parent
9c38583c6b
commit
5b030b4855
6 changed files with 6 additions and 77 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1918,7 +1918,6 @@ dependencies = [
|
||||||
"debug_print",
|
"debug_print",
|
||||||
"gcd",
|
"gcd",
|
||||||
"libc",
|
"libc",
|
||||||
"rand 0.8.4",
|
|
||||||
"signal-hook",
|
"signal-hook",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"uucore",
|
"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" }
|
uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
rand = "0.8"
|
|
||||||
tempfile = "^3"
|
tempfile = "^3"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
|
|
|
@ -5,7 +5,6 @@ mod conversion_tests;
|
||||||
mod block_unblock_tests;
|
mod block_unblock_tests;
|
||||||
mod conv_sync_tests;
|
mod conv_sync_tests;
|
||||||
|
|
||||||
use rand::prelude::*;
|
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use std::io::BufReader;
|
use std::io::BufReader;
|
||||||
use std::fs;
|
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_export]
|
||||||
macro_rules! icf (
|
macro_rules! icf (
|
||||||
() =>
|
() =>
|
||||||
|
|
|
@ -252,46 +252,6 @@ make_io_test!(
|
||||||
File::open("./test-resources/random-5828891cb1230748e146f34223bbd3b5.test").unwrap()
|
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 internal buffer size fn
|
||||||
#[test]
|
#[test]
|
||||||
fn bsize_test_primes()
|
fn bsize_test_primes()
|
||||||
|
|
|
@ -2,7 +2,6 @@ use super::*;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
build_dd_app,
|
build_dd_app,
|
||||||
IConvFlags, OConvFlags,
|
|
||||||
StatusLevel,
|
StatusLevel,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -82,7 +81,7 @@ fn icf_ctable_error()
|
||||||
|
|
||||||
let matches = build_dd_app!().get_matches_from_safe(args).unwrap();
|
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]
|
#[test]
|
||||||
|
@ -96,7 +95,7 @@ fn icf_case_error()
|
||||||
|
|
||||||
let matches = build_dd_app!().get_matches_from_safe(args).unwrap();
|
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]
|
#[test]
|
||||||
|
@ -110,7 +109,7 @@ fn icf_block_error()
|
||||||
|
|
||||||
let matches = build_dd_app!().get_matches_from_safe(args).unwrap();
|
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]
|
#[test]
|
||||||
|
@ -124,7 +123,7 @@ fn icf_creat_error()
|
||||||
|
|
||||||
let matches = build_dd_app!().get_matches_from_safe(args).unwrap();
|
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]
|
#[test]
|
||||||
|
|
|
@ -92,14 +92,6 @@ fn build_ascii_block(n: usize) -> Vec<u8>
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_ebcdic_block(n: usize) -> Vec<u8>
|
|
||||||
{
|
|
||||||
(0..=255)
|
|
||||||
.cycle()
|
|
||||||
.take(n)
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sanity Tests
|
// Sanity Tests
|
||||||
#[test]
|
#[test]
|
||||||
fn version()
|
fn version()
|
||||||
|
@ -357,7 +349,7 @@ fn test_noatime_does_not_update_ofile_atime()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[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";
|
let fname = "this-file-does-not-exist.txt";
|
||||||
assert_fixture_not_exists!(&fname);
|
assert_fixture_not_exists!(&fname);
|
||||||
|
@ -367,6 +359,7 @@ fn test_nocreat_causes_failure_when_not_present()
|
||||||
"conv=nocreat",
|
"conv=nocreat",
|
||||||
of!(&fname),
|
of!(&fname),
|
||||||
])
|
])
|
||||||
|
.pipe_in("")
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
assert!(!fix.file_exists(&fname));
|
assert!(!fix.file_exists(&fname));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue