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

numfmt: support neither or both of --to and --from

matches GNU behaviour
This commit is contained in:
Jamie McClymont 2018-09-25 01:29:05 +12:00
parent 94cd6540ba
commit f3a71215bc
2 changed files with 54 additions and 30 deletions

View file

@ -120,3 +120,28 @@ fn test_negative() {
.run()
.stdout_is("-1.0Ki\n-1.1Mi\n-102.4Mi");
}
#[test]
fn test_no_op() {
new_ucmd!()
.pipe_in("1024\n1234567")
.run()
.stdout_is("1024\n1234567");
}
#[test]
fn test_normalize() {
new_ucmd!()
.args(&["--from=si", "--to=si"])
.pipe_in("10000000K\n0.001K")
.run()
.stdout_is("10.0G\n1");
}
#[test]
fn test_si_to_iec() {
new_ucmd!()
.args(&["--from=si", "--to=iec", "15334263563K"])
.run()
.stdout_is("13.9T");
}