mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
Merge pull request #7924 from cakebaker/split_reduce_duplication_in_test
split: use delegation to avoid code duplication in test
This commit is contained in:
commit
8866ec3927
1 changed files with 2 additions and 8 deletions
|
@ -17,9 +17,7 @@ use std::{
|
||||||
};
|
};
|
||||||
use uutests::util::{AtPath, TestScenario};
|
use uutests::util::{AtPath, TestScenario};
|
||||||
|
|
||||||
use uutests::at_and_ucmd;
|
use uutests::{at_and_ucmd, new_ucmd, util_name};
|
||||||
use uutests::new_ucmd;
|
|
||||||
use uutests::util_name;
|
|
||||||
|
|
||||||
fn random_chars(n: usize) -> String {
|
fn random_chars(n: usize) -> String {
|
||||||
rng()
|
rng()
|
||||||
|
@ -114,11 +112,7 @@ impl RandomFile {
|
||||||
|
|
||||||
/// Add n lines each of size `RandomFile::LINESIZE`
|
/// Add n lines each of size `RandomFile::LINESIZE`
|
||||||
fn add_lines(&mut self, lines: usize) {
|
fn add_lines(&mut self, lines: usize) {
|
||||||
let mut n = lines;
|
self.add_lines_with_line_size(lines, Self::LINESIZE);
|
||||||
while n > 0 {
|
|
||||||
writeln!(self.inner, "{}", random_chars(Self::LINESIZE)).unwrap();
|
|
||||||
n -= 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add n lines each of the given size.
|
/// Add n lines each of the given size.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue