mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
cat: fix for numbered lines w/ no trailing newline
Make at_line_start persist between printing each file. This fixes an issue when numbering lines in the output and one of the input files does not have a trailing newline.
This commit is contained in:
parent
4a16514d2c
commit
81996915df
3 changed files with 22 additions and 14 deletions
1
tests/fixtures/cat/nonewline.txt
vendored
Normal file
1
tests/fixtures/cat/nonewline.txt
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
text without a trailing newline
|
|
@ -22,6 +22,15 @@ fn test_output_multi_files_print_all_chars() {
|
|||
pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-zM-{M-|M-}M-~M-^?");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_numbered_lines_no_trailing_newline() {
|
||||
new_ucmd!()
|
||||
.args(&["nonewline.txt", "alpha.txt", "-n"])
|
||||
.succeeds()
|
||||
.stdout_only(" 1\ttext without a trailing newlineabcde\n 2\tfghij\n \
|
||||
3\tklmno\n 4\tpqrst\n 5\tuvwxyz\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_stdin_show_nonprinting() {
|
||||
for same_param in vec!["-v", "--show-nonprinting"] {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue