mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
date: don't ignore width prefix in %N format specifier (#12010)
* do not ignore %N if specified width is smaller than default width * add test for issue #12001 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * cargo clippy * truncate instead of popping in a loop * Update format_modifiers.rs * skip truncation if width is 0 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
parent
82590984a5
commit
5fa0aba94d
@@ -3007,3 +3007,12 @@ fn test_korean_time_zone() {
|
||||
.succeeds()
|
||||
.stdout_is("2026-01-15 01:00:00 UTC\n");
|
||||
}
|
||||
|
||||
// https://github.com/uutils/coreutils/issues/12001
|
||||
// date: width prefix in %N format specifier is ignored ( %3N, %6N always output full 9 nanosecond digits) #12001
|
||||
#[test]
|
||||
fn test_nanoseconds_width_prefix_ignored_issue12001() {
|
||||
let result = new_ucmd!().arg("+%3N").succeeds();
|
||||
// compare to 4 because of \n
|
||||
assert_eq!(result.stdout().len(), 4);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user