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

cat: show \r\n as ^M$ when -E is enabled

This functionality was recently added to GNU cat, but had a bug.
This implementation will be commpatible with gnu once the bug in gnu is fixed.
This commit is contained in:
Michael Debertol 2021-08-07 21:05:47 +02:00
parent d967a7a553
commit 5be4c48546
2 changed files with 54 additions and 21 deletions

View file

@ -273,6 +273,14 @@ fn test_stdin_show_ends() {
.stdout_only("\t\0$\n\t");
}
}
#[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() {