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

csplit: don't add a newline if the file doesn't end with one (#7901)

* csplit: don't add a newline if the file doesn't end with one

* refactor test

* refactor
This commit is contained in:
Jeremy Smart 2025-05-09 03:15:54 -04:00 committed by GitHub
parent bcc02e9cea
commit a752f73476
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 63 additions and 21 deletions

View file

@ -1476,3 +1476,12 @@ fn test_directory_input_file() {
.fails_with_code(1)
.stderr_only("csplit: cannot open 'test_directory' for reading: Permission denied\n");
}
#[test]
fn test_stdin_no_trailing_newline() {
new_ucmd!()
.args(&["-", "2"])
.pipe_in("a\nb\nc\nd")
.succeeds()
.stdout_only("2\n5\n");
}