Skip to content

Commit

Permalink
stat: Some escape sequences are non-standard
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvestre committed Dec 8, 2024
1 parent 828598d commit 51b2211
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
30 changes: 15 additions & 15 deletions src/uu/stat/src/stat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,7 @@ mod tests {

#[test]
fn printf_format() {
let s = r#"%-# 15a\t\r\"\\\a\b\e\f\v%+020.-23w\x12\167\132\112\n"#;
let s = r#"%-# 15a\t\r\"\\\a\b\x1B\f\x0B%+020.-23w\x12\167\132\112\n"#;
let expected = vec![
Token::Directive {
flag: Flags {
Expand All @@ -1186,15 +1186,15 @@ mod tests {
precision: None,
format: 'a',
},
Token::Char('\t'),
Token::Char('\r'),
Token::Char('"'),
Token::Char('\\'),
Token::Char('\x07'),
Token::Char('\x08'),
Token::Char('\x1B'),
Token::Char('\x0C'),
Token::Char('\x0B'),
Token::Byte(b'\t'),
Token::Byte(b'\r'),
Token::Byte(b'"'),
Token::Byte(b'\\'),
Token::Byte(b'\x07'),
Token::Byte(b'\x08'),
Token::Byte(b'\x1B'),
Token::Byte(b'\x0C'),
Token::Byte(b'\x0B'),
Token::Directive {
flag: Flags {
sign: true,
Expand All @@ -1205,11 +1205,11 @@ mod tests {
precision: None,
format: 'w',
},
Token::Char('\x12'),
Token::Char('w'),
Token::Char('Z'),
Token::Char('J'),
Token::Char('\n'),
Token::Byte(b'\x12'),
Token::Byte(b'w'),
Token::Byte(b'Z'),
Token::Byte(b'J'),
Token::Byte(b'\n'),
];
assert_eq!(&expected, &Stater::generate_tokens(s, true).unwrap());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/by-util/test_stat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ fn test_multi_files() {
#[test]
fn test_printf() {
let args = [
"--printf=123%-# 15q\\r\\\"\\\\\\a\\b\\e\\f\\v%+020.23m\\x12\\167\\132\\112\\n",
"--printf=123%-# 15q\\r\\\"\\\\\\a\\b\\x1B\\f\\x0B%+020.23m\\x12\\167\\132\\112\\n",
"/",
];
let ts = TestScenario::new(util_name!());
Expand Down

0 comments on commit 51b2211

Please sign in to comment.