mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 19:47:45 +00:00
Merge pull request #2980 from jfinkels/split-lines-2
split: add support for "-n l/NUM" option to split
This commit is contained in:
commit
346cfa060b
2 changed files with 318 additions and 10 deletions
|
@ -570,3 +570,20 @@ fn test_elide_empty_files() {
|
|||
assert_eq!(at.read("xac"), "c");
|
||||
assert!(!at.plus("xad").exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_lines() {
|
||||
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
|
||||
};
|
||||
|
||||
// Split into two files without splitting up lines.
|
||||
ucmd.args(&["-n", "l/2", "fivelines.txt"]).succeeds();
|
||||
|
||||
assert_eq!(file_read("xaa"), "1\n2\n3\n");
|
||||
assert_eq!(file_read("xab"), "4\n5\n");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue