mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
split: r-chunk tests and infinite input
This commit is contained in:
parent
440e7b1a59
commit
7b2a3e236e
2 changed files with 44 additions and 48 deletions
|
@ -2,11 +2,13 @@
|
|||
//
|
||||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
// spell-checker:ignore xzaaa sixhundredfiftyonebytes ninetyonebytes threebytes asciilowercase ghijkl mnopq rstuv wxyz fivelines twohundredfortyonebytes onehundredlines nbbbb dxen ncccc
|
||||
// spell-checker:ignore xzaaa sixhundredfiftyonebytes ninetyonebytes threebytes asciilowercase ghijkl mnopq rstuv wxyz fivelines twohundredfortyonebytes onehundredlines nbbbb dxen ncccc rlimit NOFILE
|
||||
|
||||
use crate::common::util::{AtPath, TestScenario};
|
||||
use rand::{thread_rng, Rng, SeedableRng};
|
||||
use regex::Regex;
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
use rlimit::Resource;
|
||||
#[cfg(not(windows))]
|
||||
use std::env;
|
||||
use std::path::Path;
|
||||
|
@ -1250,10 +1252,19 @@ fn test_number_by_lines_kth_no_end_sep() {
|
|||
.succeeds()
|
||||
.stdout_only("2222\n");
|
||||
new_ucmd!()
|
||||
.args(&["-e", "-n", "l/8/10"])
|
||||
.args(&["-e", "-n", "l/2/2"])
|
||||
.pipe_in("1\n2222\n3\n4")
|
||||
.succeeds()
|
||||
.stdout_only("3\n");
|
||||
.stdout_only("3\n4");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_number_by_lines_rr_kth_no_end_sep() {
|
||||
new_ucmd!()
|
||||
.args(&["-n", "r/2/3"])
|
||||
.pipe_in("1\n2\n3\n4\n5")
|
||||
.succeeds()
|
||||
.stdout_only("2\n5");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1626,6 +1637,15 @@ fn test_round_robin() {
|
|||
assert_eq!(at.read("xab"), "2\n4\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
fn test_round_robin_limited_file_descriptors() {
|
||||
new_ucmd!()
|
||||
.args(&["-n", "r/40", "onehundredlines.txt"])
|
||||
.limit(Resource::NOFILE, 9, 9)
|
||||
.succeeds();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_split_invalid_input() {
|
||||
// Test if stdout/stderr for '--lines' option is correct
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue