mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
printf: output of double-quote should not be escaped
This is obtained by escaping the sequence `\"` as `"`.
This commit is contained in:
@@ -108,6 +108,7 @@ pub fn parse_escape_code(rest: &mut &[u8]) -> EscapedChar {
|
||||
*rest = new_rest;
|
||||
match c {
|
||||
b'\\' => EscapedChar::Byte(b'\\'),
|
||||
b'"' => EscapedChar::Byte(b'"'),
|
||||
b'a' => EscapedChar::Byte(b'\x07'),
|
||||
b'b' => EscapedChar::Byte(b'\x08'),
|
||||
b'c' => EscapedChar::End,
|
||||
|
||||
@@ -36,6 +36,11 @@ fn escaped_slash() {
|
||||
.stdout_only("hello\\ world");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unescaped_double_quote() {
|
||||
new_ucmd!().args(&["\\\""]).succeeds().stdout_only("\"");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn escaped_hex() {
|
||||
new_ucmd!().args(&["\\x41"]).succeeds().stdout_only("A");
|
||||
|
||||
Reference in New Issue
Block a user