1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

cut.pl: adjust to our messages as they are better (#6921)

* cut.pl: adjust to our messages as they are better

but we still have some differences on this test

* cut: add some missing line return when needed

* cut: add failing tests covered by cut.pl

* Remove dup test

* cut: add spell-checker:ignore line to test

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
This commit is contained in:
Sylvestre Ledru 2024-12-16 15:37:29 +01:00 committed by GitHub
parent 388624996b
commit 6755956bc4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 113 additions and 3 deletions

View file

@ -2,6 +2,9 @@
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
// spell-checker:ignore defg
use crate::common::util::TestScenario;
static INPUT: &str = "lists.txt";
@ -288,7 +291,7 @@ fn test_newline_delimited() {
.args(&["-f", "1", "-d", "\n"])
.pipe_in("a:1\nb:")
.succeeds()
.stdout_only_bytes("a:1\n");
.stdout_only_bytes("a:1\nb:\n");
}
#[test]
@ -329,3 +332,31 @@ fn test_8bit_non_utf8_delimiter() {
.succeeds()
.stdout_check(|out| out == "b_c\n".as_bytes());
}
#[test]
fn test_newline_preservation_with_f1_option() {
let (at, mut ucmd) = at_and_ucmd!();
at.write("1", "a\nb");
let expected = "a\nb\n";
ucmd.args(&["-f1-", "1"]).succeeds().stdout_is(expected);
}
#[ignore = "Not yet implemented"]
#[test]
fn test_output_delimiter_with_character_ranges() {
new_ucmd!()
.args(&["-c2-3,4-", "--output-delim=:"])
.pipe_in("abcdefg\n")
.succeeds()
.stdout_only("bc:defg\n");
}
#[ignore = "Not yet implemented"]
#[test]
fn test_output_delimiter_with_adjacent_ranges() {
new_ucmd!()
.args(&["-b1-2,3-4", "--output-d=:"])
.pipe_in("abcd\n")
.succeeds()
.stdout_only("ab:cd\n");
}