mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-09-15 19:36:16 +00:00
Merge pull request #3281 from jfinkels/split-round-robin
split: implement round-robin arg to --number
This commit is contained in:
commit
c766726e8b
2 changed files with 60 additions and 0 deletions
|
@ -743,3 +743,19 @@ fn test_hex_suffix() {
|
|||
assert_eq!(at.read("x0b"), "c");
|
||||
assert_eq!(at.read("x0c"), "");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_round_robin() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
||||
let file_read = |f| {
|
||||
let mut s = String::new();
|
||||
at.open(f).read_to_string(&mut s).unwrap();
|
||||
s
|
||||
};
|
||||
|
||||
ucmd.args(&["-n", "r/2", "fivelines.txt"]).succeeds();
|
||||
|
||||
assert_eq!(file_read("xaa"), "1\n3\n5\n");
|
||||
assert_eq!(file_read("xab"), "2\n4\n");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue