1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

Update test_cat.rs

Refactored to constants
This commit is contained in:
Chad Brewbaker 2021-05-19 04:06:46 -05:00 committed by GitHub
parent a69cb11de9
commit 9167a4128d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -348,12 +348,12 @@ fn test_squeeze_blank_before_numbering() {
fn test_dev_random() { fn test_dev_random() {
let mut buf = [0; 2048]; let mut buf = [0; 2048];
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
fn rand_gen() -> &'static str { "/dev/urandom"} const DEV_RANDOM: &str = "/dev/urandom";
#[cfg(not(target_os = "linux"))] #[cfg(not(target_os = "linux"))]
fn rand_gen() -> &'static str { "/dev/random"} const DEV_RANDOM: &str = "/dev/random";
let mut proc = new_ucmd!().args(&[rand_gen()]).run_no_wait(); let mut proc = new_ucmd!().args(&[DEV_RANDOM]).run_no_wait();
let mut proc_stdout = proc.stdout.take().unwrap(); let mut proc_stdout = proc.stdout.take().unwrap();
proc_stdout.read_exact(&mut buf).unwrap(); proc_stdout.read_exact(&mut buf).unwrap();