mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2026-01-21 04:31:13 +00:00
- Adds support for calling dd fn from cl - Adds basic cl tests from project root - Adds support for multiplier strings (c, w, b, kB, KB, KiB, ... EB, E, EiB.
61 lines
5.6 KiB
Rust
61 lines
5.6 KiB
Rust
use crate::common::util::*;
|
|
|
|
use std::io::prelude::*;
|
|
use std::io::BufReader;
|
|
use std::fs::{self, File};
|
|
|
|
#[test]
|
|
fn dd_zeros_to_stdout_test_from_args()
|
|
{
|
|
new_ucmd!()
|
|
.args(&[
|
|
"if=../../src/uu/dd/test-resources/zeros-620f0b67a91f7f74151bc5be745b7110.test",
|
|
])
|
|
.succeeds()
|
|
.stdout_only(
|
|
"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
|
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
|
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
|
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
|
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
|
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
|
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
|
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
|
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
|
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
|
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
|
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
|
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
|
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
|
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
|
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
|
|
"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn dd_ones_to_file_test_from_args()
|
|
{
|
|
let tmp_fname = "../../src/uu/dd/test-resources/FAILED-ones-to-file-from-args.test";
|
|
|
|
new_ucmd!()
|
|
.args(&[
|
|
"if=../../src/uu/dd/test-resources/ones-6ae59e64850377ee5470c854761551ea.test",
|
|
&format!("of={}", &tmp_fname),
|
|
])
|
|
.succeeds();
|
|
|
|
let res = File::open(&tmp_fname).unwrap();
|
|
let res = BufReader::new(res);
|
|
|
|
let spec = File::open("../../src/uu/dd/test-resources/ones-6ae59e64850377ee5470c854761551ea.test").unwrap();
|
|
let spec = BufReader::new(spec);
|
|
|
|
for (b_res, b_spec) in res.bytes().zip(spec.bytes())
|
|
{
|
|
assert_eq!(b_res.unwrap(),
|
|
b_spec.unwrap());
|
|
}
|
|
|
|
fs::remove_file(&tmp_fname).unwrap();
|
|
}
|