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

date: support -f - to read from stdin

So far `date -f -` was not reading from stdin. This commit fixes
this.

Closes: #6058
This commit is contained in:
Michael Vogt 2024-03-31 21:15:46 +02:00
parent 0ef06bd82d
commit af0ba86657
2 changed files with 28 additions and 1 deletions

View file

@ -426,3 +426,21 @@ fn test_date_parse_from_format() {
.arg("+%Y-%m-%d %H:%M:%S")
.succeeds();
}
#[test]
fn test_date_from_stdin() {
new_ucmd!()
.arg("-f")
.arg("-")
.pipe_in(
"2023-03-27 08:30:00\n\
2023-04-01 12:00:00\n\
2023-04-15 18:30:00\n",
)
.succeeds()
.stdout_is(
"Mon Mar 27 08:30:00 2023\n\
Sat Apr 1 12:00:00 2023\n\
Sat Apr 15 18:30:00 2023\n",
);
}