mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
Merge pull request #2552 from miDeb/cat/show-crlf
cat: show `\r\n` as `^M$` when `-E` is enabled
This commit is contained in:
commit
ee98efd92e
2 changed files with 73 additions and 25 deletions
|
@ -273,6 +273,26 @@ fn test_stdin_show_ends() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn squeeze_all_files() {
|
||||
// empty lines at the end of a file are "squeezed" together with empty lines at the beginning
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
at.write("input1", "a\n\n");
|
||||
at.write("input2", "\n\nb");
|
||||
ucmd.args(&["input1", "input2", "-s"])
|
||||
.succeeds()
|
||||
.stdout_only("a\n\nb");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_show_ends_crlf() {
|
||||
new_ucmd!()
|
||||
.arg("-E")
|
||||
.pipe_in("a\nb\r\n\rc\n\r\n\r")
|
||||
.succeeds()
|
||||
.stdout_only("a$\nb^M$\n\rc$\n^M$\n\r");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_stdin_show_all() {
|
||||
for same_param in &["-A", "--show-all"] {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue