mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Merge pull request #1354 from ccbrown/rewrite-echo
echo: rewrite for readability and tests
This commit is contained in:
commit
100f6df2bf
2 changed files with 92 additions and 103 deletions
|
@ -48,6 +48,21 @@ fn test_escape_hex() {
|
|||
new_ucmd!().args(&["-e", "\\x41"]).succeeds().stdout_only("A");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_escape_short_hex() {
|
||||
new_ucmd!().args(&["-e", "foo\\xa bar"]).succeeds().stdout_only("foo\n bar");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_escape_no_hex() {
|
||||
new_ucmd!().args(&["-e", "foo\\x bar"]).succeeds().stdout_only("foo\\x bar");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_escape_one_slash() {
|
||||
new_ucmd!().args(&["-e", "foo\\ bar"]).succeeds().stdout_only("foo\\ bar");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_escape_newline() {
|
||||
new_ucmd!().args(&["-e", "\\na"]).succeeds().stdout_only("\na");
|
||||
|
@ -55,7 +70,7 @@ fn test_escape_newline() {
|
|||
|
||||
#[test]
|
||||
fn test_escape_no_further_output() {
|
||||
new_ucmd!().args(&["-e", "a\\cb"]).succeeds().stdout_only("a\n");
|
||||
new_ucmd!().args(&["-e", "a\\cb", "c"]).succeeds().stdout_only("a\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -63,6 +78,16 @@ fn test_escape_octal() {
|
|||
new_ucmd!().args(&["-e", "\\0100"]).succeeds().stdout_only("@");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_escape_short_octal() {
|
||||
new_ucmd!().args(&["-e", "foo\\040bar"]).succeeds().stdout_only("foo bar");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_escape_no_octal() {
|
||||
new_ucmd!().args(&["-e", "foo\\0 bar"]).succeeds().stdout_only("foo\\0 bar");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_escape_tab() {
|
||||
new_ucmd!().args(&["-e", "\\t"]).succeeds().stdout_only("\t\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue