mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
split: pass GNU test l-chunk
This commit is contained in:
parent
97d30bd486
commit
4dc46f10e9
3 changed files with 264 additions and 176 deletions
|
@ -606,13 +606,13 @@ fn test_split_obs_lines_as_other_option_value() {
|
|||
.args(&["-n", "-200", "file"])
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.stderr_contains("split: invalid number of chunks: -200\n");
|
||||
.stderr_contains("split: invalid number of chunks: '-200'\n");
|
||||
scene
|
||||
.ucmd()
|
||||
.args(&["--number", "-e200", "file"])
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.stderr_contains("split: invalid number of chunks: -e200\n");
|
||||
.stderr_contains("split: invalid number of chunks: '-e200'\n");
|
||||
}
|
||||
|
||||
/// Test for using more than one obsolete lines option (standalone)
|
||||
|
@ -708,7 +708,7 @@ fn test_split_overflow_bytes_size() {
|
|||
fn test_split_stdin_num_chunks() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["--number=1"]).pipe_in("").succeeds();
|
||||
assert_eq!(file_read(&at, "xaa"), "");
|
||||
assert_eq!(at.read("xaa"), "");
|
||||
assert!(!at.plus("xab").exists());
|
||||
}
|
||||
|
||||
|
@ -727,8 +727,8 @@ fn test_split_stdin_num_line_chunks() {
|
|||
ucmd.args(&["--number=l/2"])
|
||||
.pipe_in("1\n2\n3\n4\n5\n")
|
||||
.succeeds();
|
||||
assert_eq!(file_read(&at, "xaa"), "1\n2\n3\n");
|
||||
assert_eq!(file_read(&at, "xab"), "4\n5\n");
|
||||
assert_eq!(at.read("xaa"), "1\n2\n3\n");
|
||||
assert_eq!(at.read("xab"), "4\n5\n");
|
||||
assert!(!at.plus("xac").exists());
|
||||
}
|
||||
|
||||
|
@ -741,12 +741,6 @@ fn test_split_stdin_num_kth_line_chunk() {
|
|||
.stdout_only("2\n");
|
||||
}
|
||||
|
||||
fn file_read(at: &AtPath, filename: &str) -> String {
|
||||
let mut s = String::new();
|
||||
at.open(filename).read_to_string(&mut s).unwrap();
|
||||
s
|
||||
}
|
||||
|
||||
/// Test for the default suffix length behavior: dynamically increasing size.
|
||||
#[test]
|
||||
fn test_alphabetic_dynamic_suffix_length() {
|
||||
|
@ -766,11 +760,11 @@ fn test_alphabetic_dynamic_suffix_length() {
|
|||
for i in b'a'..=b'y' {
|
||||
for j in b'a'..=b'z' {
|
||||
let filename = format!("x{}{}", i as char, j as char);
|
||||
let contents = file_read(&at, &filename);
|
||||
let contents = at.read(&filename);
|
||||
assert_eq!(contents, "a");
|
||||
}
|
||||
}
|
||||
assert_eq!(file_read(&at, "xzaaa"), "a");
|
||||
assert_eq!(at.read("xzaaa"), "a");
|
||||
}
|
||||
|
||||
/// Test for the default suffix length behavior: dynamically increasing size.
|
||||
|
@ -790,10 +784,10 @@ fn test_numeric_dynamic_suffix_length() {
|
|||
.succeeds();
|
||||
for i in 0..90 {
|
||||
let filename = format!("x{i:02}");
|
||||
let contents = file_read(&at, &filename);
|
||||
let contents = at.read(&filename);
|
||||
assert_eq!(contents, "a");
|
||||
}
|
||||
assert_eq!(file_read(&at, "x9000"), "a");
|
||||
assert_eq!(at.read("x9000"), "a");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -812,10 +806,10 @@ fn test_hex_dynamic_suffix_length() {
|
|||
.succeeds();
|
||||
for i in 0..240 {
|
||||
let filename = format!("x{i:02x}");
|
||||
let contents = file_read(&at, &filename);
|
||||
let contents = at.read(&filename);
|
||||
assert_eq!(contents, "a");
|
||||
}
|
||||
assert_eq!(file_read(&at, "xf000"), "a");
|
||||
assert_eq!(at.read("xf000"), "a");
|
||||
}
|
||||
|
||||
/// Test for dynamic suffix length (auto-widening) disabled when suffix start number is specified
|
||||
|
@ -833,7 +827,7 @@ fn test_dynamic_suffix_length_on_with_suffix_start_no_value() {
|
|||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["-b", "1", "--numeric-suffixes", "ninetyonebytes.txt"])
|
||||
.succeeds();
|
||||
assert_eq!(file_read(&at, "x9000"), "a");
|
||||
assert_eq!(at.read("x9000"), "a");
|
||||
}
|
||||
|
||||
/// Test for suffix auto-width with --number strategy and suffix start number
|
||||
|
@ -845,8 +839,8 @@ fn test_suffix_auto_width_with_number() {
|
|||
let glob = Glob::new(&at, ".", r"x\d\d\d$");
|
||||
assert_eq!(glob.count(), 100);
|
||||
assert_eq!(glob.collate(), at.read_bytes("fivelines.txt"));
|
||||
assert_eq!(file_read(&at, "x001"), "1\n");
|
||||
assert_eq!(file_read(&at, "x100"), "");
|
||||
assert_eq!(at.read("x001"), "1\n");
|
||||
assert_eq!(at.read("x100"), "");
|
||||
|
||||
new_ucmd!()
|
||||
.args(&["--numeric-suffixes=100", "--number=r/100", "fivelines.txt"])
|
||||
|
@ -926,17 +920,12 @@ creating file 'xaf'
|
|||
#[test]
|
||||
fn test_number_n() {
|
||||
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", "5", "asciilowercase.txt"]).succeeds();
|
||||
assert_eq!(file_read("xaa"), "abcdef");
|
||||
assert_eq!(file_read("xab"), "ghijkl");
|
||||
assert_eq!(file_read("xac"), "mnopq");
|
||||
assert_eq!(file_read("xad"), "rstuv");
|
||||
assert_eq!(file_read("xae"), "wxyz\n");
|
||||
assert_eq!(at.read("xaa"), "abcdef");
|
||||
assert_eq!(at.read("xab"), "ghijkl");
|
||||
assert_eq!(at.read("xac"), "mnopq");
|
||||
assert_eq!(at.read("xad"), "rstuv");
|
||||
assert_eq!(at.read("xae"), "wxyz\n");
|
||||
#[cfg(unix)]
|
||||
new_ucmd!()
|
||||
.args(&["--number=100", "/dev/null"])
|
||||
|
@ -974,11 +963,11 @@ fn test_number_kth_of_n() {
|
|||
new_ucmd!()
|
||||
.args(&["--number=0/5", "asciilowercase.txt"])
|
||||
.fails()
|
||||
.stderr_contains("split: invalid chunk number: 0");
|
||||
.stderr_contains("split: invalid chunk number: '0'");
|
||||
new_ucmd!()
|
||||
.args(&["--number=10/5", "asciilowercase.txt"])
|
||||
.fails()
|
||||
.stderr_contains("split: invalid chunk number: 10");
|
||||
.stderr_contains("split: invalid chunk number: '10'");
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
new_ucmd!()
|
||||
.args(&[
|
||||
|
@ -986,7 +975,7 @@ fn test_number_kth_of_n() {
|
|||
"asciilowercase.txt",
|
||||
])
|
||||
.fails()
|
||||
.stderr_contains("split: invalid number of chunks: 18446744073709551616");
|
||||
.stderr_contains("split: invalid number of chunks: '18446744073709551616'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1020,32 +1009,27 @@ fn test_number_kth_of_n_round_robin() {
|
|||
"fivelines.txt",
|
||||
])
|
||||
.fails()
|
||||
.stderr_contains("split: invalid number of chunks: 18446744073709551616");
|
||||
.stderr_contains("split: invalid number of chunks: '18446744073709551616'");
|
||||
new_ucmd!()
|
||||
.args(&["--number", "r/0/3", "fivelines.txt"])
|
||||
.fails()
|
||||
.stderr_contains("split: invalid chunk number: 0");
|
||||
.stderr_contains("split: invalid chunk number: '0'");
|
||||
new_ucmd!()
|
||||
.args(&["--number", "r/10/3", "fivelines.txt"])
|
||||
.fails()
|
||||
.stderr_contains("split: invalid chunk number: 10");
|
||||
.stderr_contains("split: invalid chunk number: '10'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_split_number_with_io_blksize() {
|
||||
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", "5", "asciilowercase.txt", "---io-blksize", "1024"])
|
||||
.succeeds();
|
||||
assert_eq!(file_read("xaa"), "abcdef");
|
||||
assert_eq!(file_read("xab"), "ghijkl");
|
||||
assert_eq!(file_read("xac"), "mnopq");
|
||||
assert_eq!(file_read("xad"), "rstuv");
|
||||
assert_eq!(file_read("xae"), "wxyz\n");
|
||||
assert_eq!(at.read("xaa"), "abcdef");
|
||||
assert_eq!(at.read("xab"), "ghijkl");
|
||||
assert_eq!(at.read("xac"), "mnopq");
|
||||
assert_eq!(at.read("xad"), "rstuv");
|
||||
assert_eq!(at.read("xae"), "wxyz\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1153,7 +1137,7 @@ fn test_allow_empty_files() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_elide_empty_files() {
|
||||
fn test_elide_empty_files_n_chunks() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["-e", "-n", "4", "threebytes.txt"])
|
||||
.succeeds()
|
||||
|
@ -1167,7 +1151,7 @@ fn test_elide_empty_files() {
|
|||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_elide_dev_null() {
|
||||
fn test_elide_dev_null_n_chunks() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["-e", "-n", "3", "/dev/null"])
|
||||
.succeeds()
|
||||
|
@ -1191,24 +1175,58 @@ fn test_dev_zero() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_lines() {
|
||||
fn test_elide_empty_files_l_chunks() {
|
||||
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");
|
||||
ucmd.args(&["-e", "-n", "l/7", "fivelines.txt"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
assert_eq!(at.read("xaa"), "1\n");
|
||||
assert_eq!(at.read("xab"), "2\n");
|
||||
assert_eq!(at.read("xac"), "3\n");
|
||||
assert_eq!(at.read("xad"), "4\n");
|
||||
assert_eq!(at.read("xae"), "5\n");
|
||||
assert!(!at.plus("xaf").exists());
|
||||
assert!(!at.plus("xag").exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_lines_kth() {
|
||||
#[cfg(unix)]
|
||||
fn test_elide_dev_null_l_chunks() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["-e", "-n", "l/3", "/dev/null"])
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.no_stderr();
|
||||
assert!(!at.plus("xaa").exists());
|
||||
assert!(!at.plus("xab").exists());
|
||||
assert!(!at.plus("xac").exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_number_by_bytes_dev_zero() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.args(&["-n", "3", "/dev/zero"])
|
||||
.fails()
|
||||
.stderr_only("split: /dev/zero: cannot determine file size\n");
|
||||
assert!(!at.plus("xaa").exists());
|
||||
assert!(!at.plus("xab").exists());
|
||||
assert!(!at.plus("xac").exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_number_by_lines() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
// Split into two files without splitting up lines.
|
||||
ucmd.args(&["-n", "l/2", "fivelines.txt"]).succeeds();
|
||||
|
||||
assert_eq!(at.read("xaa"), "1\n2\n3\n");
|
||||
assert_eq!(at.read("xab"), "4\n5\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_number_by_lines_kth() {
|
||||
new_ucmd!()
|
||||
.args(&["-n", "l/3/10", "onehundredlines.txt"])
|
||||
.succeeds()
|
||||
|
@ -1217,13 +1235,27 @@ fn test_lines_kth() {
|
|||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_lines_kth_dev_null() {
|
||||
fn test_number_by_lines_kth_dev_null() {
|
||||
new_ucmd!()
|
||||
.args(&["-n", "l/3/10", "/dev/null"])
|
||||
.succeeds()
|
||||
.stdout_only("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_number_by_lines_kth_no_end_sep() {
|
||||
new_ucmd!()
|
||||
.args(&["-n", "l/3/10"])
|
||||
.pipe_in("1\n2222\n3\n4")
|
||||
.succeeds()
|
||||
.stdout_only("2222\n");
|
||||
new_ucmd!()
|
||||
.args(&["-e", "-n", "l/8/10"])
|
||||
.pipe_in("1\n2222\n3\n4")
|
||||
.succeeds()
|
||||
.stdout_only("3\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_line_bytes() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
@ -1588,17 +1620,10 @@ fn test_effective_suffix_hex_last() {
|
|||
#[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");
|
||||
assert_eq!(at.read("xaa"), "1\n3\n5\n");
|
||||
assert_eq!(at.read("xab"), "2\n4\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1631,7 +1656,7 @@ fn test_split_invalid_input() {
|
|||
.args(&["-n", "0", "file"])
|
||||
.fails()
|
||||
.no_stdout()
|
||||
.stderr_contains("split: invalid number of chunks: 0");
|
||||
.stderr_contains("split: invalid number of chunks: '0'");
|
||||
}
|
||||
|
||||
/// Test if there are invalid (non UTF-8) in the arguments - unix
|
||||
|
@ -1690,9 +1715,9 @@ fn test_split_separator_nl_lines() {
|
|||
.pipe_in("1\n2\n3\n4\n5\n")
|
||||
.succeeds();
|
||||
|
||||
assert_eq!(file_read(&at, "xaa"), "1\n2\n");
|
||||
assert_eq!(file_read(&at, "xab"), "3\n4\n");
|
||||
assert_eq!(file_read(&at, "xac"), "5\n");
|
||||
assert_eq!(at.read("xaa"), "1\n2\n");
|
||||
assert_eq!(at.read("xab"), "3\n4\n");
|
||||
assert_eq!(at.read("xac"), "5\n");
|
||||
assert!(!at.plus("xad").exists());
|
||||
}
|
||||
|
||||
|
@ -1703,9 +1728,9 @@ fn test_split_separator_nl_line_bytes() {
|
|||
.pipe_in("1\n2\n3\n4\n5\n")
|
||||
.succeeds();
|
||||
|
||||
assert_eq!(file_read(&at, "xaa"), "1\n2\n");
|
||||
assert_eq!(file_read(&at, "xab"), "3\n4\n");
|
||||
assert_eq!(file_read(&at, "xac"), "5\n");
|
||||
assert_eq!(at.read("xaa"), "1\n2\n");
|
||||
assert_eq!(at.read("xab"), "3\n4\n");
|
||||
assert_eq!(at.read("xac"), "5\n");
|
||||
assert!(!at.plus("xad").exists());
|
||||
}
|
||||
|
||||
|
@ -1715,9 +1740,9 @@ fn test_split_separator_nl_number_l() {
|
|||
ucmd.args(&["--number=l/3", "--separator=\n", "fivelines.txt"])
|
||||
.succeeds();
|
||||
|
||||
assert_eq!(file_read(&at, "xaa"), "1\n2\n");
|
||||
assert_eq!(file_read(&at, "xab"), "3\n4\n");
|
||||
assert_eq!(file_read(&at, "xac"), "5\n");
|
||||
assert_eq!(at.read("xaa"), "1\n2\n");
|
||||
assert_eq!(at.read("xab"), "3\n4\n");
|
||||
assert_eq!(at.read("xac"), "5\n");
|
||||
assert!(!at.plus("xad").exists());
|
||||
}
|
||||
|
||||
|
@ -1727,9 +1752,9 @@ fn test_split_separator_nl_number_r() {
|
|||
ucmd.args(&["--number=r/3", "--separator", "\n", "fivelines.txt"])
|
||||
.succeeds();
|
||||
|
||||
assert_eq!(file_read(&at, "xaa"), "1\n4\n");
|
||||
assert_eq!(file_read(&at, "xab"), "2\n5\n");
|
||||
assert_eq!(file_read(&at, "xac"), "3\n");
|
||||
assert_eq!(at.read("xaa"), "1\n4\n");
|
||||
assert_eq!(at.read("xab"), "2\n5\n");
|
||||
assert_eq!(at.read("xac"), "3\n");
|
||||
assert!(!at.plus("xad").exists());
|
||||
}
|
||||
|
||||
|
@ -1739,9 +1764,9 @@ fn test_split_separator_nul_lines() {
|
|||
ucmd.args(&["--lines=2", "-t", "\\0", "separator_nul.txt"])
|
||||
.succeeds();
|
||||
|
||||
assert_eq!(file_read(&at, "xaa"), "1\x002\0");
|
||||
assert_eq!(file_read(&at, "xab"), "3\x004\0");
|
||||
assert_eq!(file_read(&at, "xac"), "5\0");
|
||||
assert_eq!(at.read("xaa"), "1\x002\0");
|
||||
assert_eq!(at.read("xab"), "3\x004\0");
|
||||
assert_eq!(at.read("xac"), "5\0");
|
||||
assert!(!at.plus("xad").exists());
|
||||
}
|
||||
|
||||
|
@ -1751,9 +1776,9 @@ fn test_split_separator_nul_line_bytes() {
|
|||
ucmd.args(&["--line-bytes=4", "-t", "\\0", "separator_nul.txt"])
|
||||
.succeeds();
|
||||
|
||||
assert_eq!(file_read(&at, "xaa"), "1\x002\0");
|
||||
assert_eq!(file_read(&at, "xab"), "3\x004\0");
|
||||
assert_eq!(file_read(&at, "xac"), "5\0");
|
||||
assert_eq!(at.read("xaa"), "1\x002\0");
|
||||
assert_eq!(at.read("xab"), "3\x004\0");
|
||||
assert_eq!(at.read("xac"), "5\0");
|
||||
assert!(!at.plus("xad").exists());
|
||||
}
|
||||
|
||||
|
@ -1763,9 +1788,9 @@ fn test_split_separator_nul_number_l() {
|
|||
ucmd.args(&["--number=l/3", "--separator=\\0", "separator_nul.txt"])
|
||||
.succeeds();
|
||||
|
||||
assert_eq!(file_read(&at, "xaa"), "1\x002\0");
|
||||
assert_eq!(file_read(&at, "xab"), "3\x004\0");
|
||||
assert_eq!(file_read(&at, "xac"), "5\0");
|
||||
assert_eq!(at.read("xaa"), "1\x002\0");
|
||||
assert_eq!(at.read("xab"), "3\x004\0");
|
||||
assert_eq!(at.read("xac"), "5\0");
|
||||
assert!(!at.plus("xad").exists());
|
||||
}
|
||||
|
||||
|
@ -1775,9 +1800,9 @@ fn test_split_separator_nul_number_r() {
|
|||
ucmd.args(&["--number=r/3", "--separator=\\0", "separator_nul.txt"])
|
||||
.succeeds();
|
||||
|
||||
assert_eq!(file_read(&at, "xaa"), "1\x004\0");
|
||||
assert_eq!(file_read(&at, "xab"), "2\x005\0");
|
||||
assert_eq!(file_read(&at, "xac"), "3\0");
|
||||
assert_eq!(at.read("xaa"), "1\x004\0");
|
||||
assert_eq!(at.read("xab"), "2\x005\0");
|
||||
assert_eq!(at.read("xac"), "3\0");
|
||||
assert!(!at.plus("xad").exists());
|
||||
}
|
||||
|
||||
|
@ -1787,9 +1812,9 @@ fn test_split_separator_semicolon_lines() {
|
|||
ucmd.args(&["--lines=2", "-t", ";", "separator_semicolon.txt"])
|
||||
.succeeds();
|
||||
|
||||
assert_eq!(file_read(&at, "xaa"), "1;2;");
|
||||
assert_eq!(file_read(&at, "xab"), "3;4;");
|
||||
assert_eq!(file_read(&at, "xac"), "5;");
|
||||
assert_eq!(at.read("xaa"), "1;2;");
|
||||
assert_eq!(at.read("xab"), "3;4;");
|
||||
assert_eq!(at.read("xac"), "5;");
|
||||
assert!(!at.plus("xad").exists());
|
||||
}
|
||||
|
||||
|
@ -1799,9 +1824,9 @@ fn test_split_separator_semicolon_line_bytes() {
|
|||
ucmd.args(&["--line-bytes=4", "-t", ";", "separator_semicolon.txt"])
|
||||
.succeeds();
|
||||
|
||||
assert_eq!(file_read(&at, "xaa"), "1;2;");
|
||||
assert_eq!(file_read(&at, "xab"), "3;4;");
|
||||
assert_eq!(file_read(&at, "xac"), "5;");
|
||||
assert_eq!(at.read("xaa"), "1;2;");
|
||||
assert_eq!(at.read("xab"), "3;4;");
|
||||
assert_eq!(at.read("xac"), "5;");
|
||||
assert!(!at.plus("xad").exists());
|
||||
}
|
||||
|
||||
|
@ -1811,9 +1836,9 @@ fn test_split_separator_semicolon_number_l() {
|
|||
ucmd.args(&["--number=l/3", "--separator=;", "separator_semicolon.txt"])
|
||||
.succeeds();
|
||||
|
||||
assert_eq!(file_read(&at, "xaa"), "1;2;");
|
||||
assert_eq!(file_read(&at, "xab"), "3;4;");
|
||||
assert_eq!(file_read(&at, "xac"), "5;");
|
||||
assert_eq!(at.read("xaa"), "1;2;");
|
||||
assert_eq!(at.read("xab"), "3;4;");
|
||||
assert_eq!(at.read("xac"), "5;");
|
||||
assert!(!at.plus("xad").exists());
|
||||
}
|
||||
|
||||
|
@ -1823,9 +1848,9 @@ fn test_split_separator_semicolon_number_r() {
|
|||
ucmd.args(&["--number=r/3", "--separator=;", "separator_semicolon.txt"])
|
||||
.succeeds();
|
||||
|
||||
assert_eq!(file_read(&at, "xaa"), "1;4;");
|
||||
assert_eq!(file_read(&at, "xab"), "2;5;");
|
||||
assert_eq!(file_read(&at, "xac"), "3;");
|
||||
assert_eq!(at.read("xaa"), "1;4;");
|
||||
assert_eq!(at.read("xab"), "2;5;");
|
||||
assert_eq!(at.read("xac"), "3;");
|
||||
assert!(!at.plus("xad").exists());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue