1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-15 19:36:16 +00:00

ls: add support for +FORMAT in timestyle

This commit is contained in:
David Matos 2022-09-27 23:03:51 +02:00 committed by Sylvestre Ledru
parent e523a56dab
commit b8a5588b81
2 changed files with 70 additions and 30 deletions

View file

@ -1653,6 +1653,7 @@ fn test_ls_styles() {
let re_iso = Regex::new(r"[a-z-]* \d* \w* \w* \d* \d{2}-\d{2} \d{2}:\d{2} test\n").unwrap();
let re_locale =
Regex::new(r"[a-z-]* \d* \w* \w* \d* [A-Z][a-z]{2} ( |\d)\d \d{2}:\d{2} test\n").unwrap();
let re_custom_format = Regex::new(r"[a-z-]* \d* \w* \w* \d* \d{4}__\d{2} test\n").unwrap();
//full-iso
let result = scene
@ -1675,6 +1676,17 @@ fn test_ls_styles() {
let result = scene.ucmd().arg("-l").arg("--time-style=locale").succeeds();
assert!(re_locale.is_match(result.stdout_str()));
//+FORMAT
let result = scene
.ucmd()
.arg("-l")
.arg("--time-style=+%Y__%M")
.succeeds();
assert!(re_custom_format.is_match(result.stdout_str()));
// Also fails due to not having full clap support for time_styles
scene.ucmd().arg("-l").arg("-time-style=invalid").fails();
//Overwrite options tests
let result = scene
.ucmd()