Skip to content

Commit 8866ec3

Browse files
authored
Merge pull request #7924 from cakebaker/split_reduce_duplication_in_test
split: use delegation to avoid code duplication in test
2 parents 402907e + 0c53409 commit 8866ec3

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

tests/by-util/test_split.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ use std::{
1717
};
1818
use uutests::util::{AtPath, TestScenario};
1919

20-
use uutests::at_and_ucmd;
21-
use uutests::new_ucmd;
22-
use uutests::util_name;
20+
use uutests::{at_and_ucmd, new_ucmd, util_name};
2321

2422
fn random_chars(n: usize) -> String {
2523
rng()
@@ -114,11 +112,7 @@ impl RandomFile {
114112

115113
/// Add n lines each of size `RandomFile::LINESIZE`
116114
fn add_lines(&mut self, lines: usize) {
117-
let mut n = lines;
118-
while n > 0 {
119-
writeln!(self.inner, "{}", random_chars(Self::LINESIZE)).unwrap();
120-
n -= 1;
121-
}
115+
self.add_lines_with_line_size(lines, Self::LINESIZE);
122116
}
123117

124118
/// Add n lines each of the given size.

0 commit comments

Comments
 (0)