mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 19:47:45 +00:00
truncate: fix character used to indicate round up
Fix a bug in which the incorrect character was being used to indicate "round up to the nearest multiple" mode. The character was "*" but it should be "%". This commit corrects that.
This commit is contained in:
parent
b9e99543db
commit
a23555e857
2 changed files with 2 additions and 2 deletions
|
@ -147,7 +147,7 @@ fn truncate(
|
||||||
'<' => TruncateMode::AtMost,
|
'<' => TruncateMode::AtMost,
|
||||||
'>' => TruncateMode::AtLeast,
|
'>' => TruncateMode::AtLeast,
|
||||||
'/' => TruncateMode::RoundDown,
|
'/' => TruncateMode::RoundDown,
|
||||||
'*' => TruncateMode::RoundUp,
|
'%' => TruncateMode::RoundUp,
|
||||||
_ => TruncateMode::Absolute, /* assume that the size is just a number */
|
_ => TruncateMode::Absolute, /* assume that the size is just a number */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -206,7 +206,7 @@ fn test_round_up() {
|
||||||
let (at, mut ucmd) = at_and_ucmd!();
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
let mut file = at.make_file(TFILE2);
|
let mut file = at.make_file(TFILE2);
|
||||||
file.write_all(b"1234567890").unwrap();
|
file.write_all(b"1234567890").unwrap();
|
||||||
ucmd.args(&["--size", "*4", TFILE2]).succeeds();
|
ucmd.args(&["--size", "%4", TFILE2]).succeeds();
|
||||||
file.seek(SeekFrom::End(0)).unwrap();
|
file.seek(SeekFrom::End(0)).unwrap();
|
||||||
let actual = file.seek(SeekFrom::Current(0)).unwrap();
|
let actual = file.seek(SeekFrom::Current(0)).unwrap();
|
||||||
assert!(
|
assert!(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue