Skip to content

date: add test for locale default format timezone position - #10983

Merged
sylvestre merged 2 commits into
uutils:mainfrom
sylvestre:date-locale-hour
Oct 9, 2026
Merged

sylvestre merged 2 commits into
uutils:mainfrom
sylvestre:date-locale-hour

Conversation

@sylvestre

@sylvestre sylvestre commented Feb 16, 2026 •

Copy link
Copy Markdown
Contributor

Covers date-locale-hour.sh

follow up #10935

@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/date/resolution. tests/date/resolution is passing on 'main'. Maybe you have to rebase?
Skipping an intermittent issue tests/tail/symlink (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/cut/bounded-memory is no longer failing!
Congrats! The gnu test tests/misc/io-errors is no longer failing!
Note: The gnu test tests/cp/link-heap is now being skipped but was previously passing.
Note: The gnu test tests/rm/many-dir-entries-vs-OOM is now being skipped but was previously passing.

Comment thread tests/by-util/test_date.rs Outdated
// Verify timezone appears after time, not between date and year
// Test with en_IE locale which should have timezone after time
let result = new_ucmd!()
.env("LC_ALL", "en_IE")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use C? That would allow you to use succeeds() instead of run() and to get rid of lines 2112 - 2115.

Comment thread tests/by-util/test_date.rs Outdated
Comment on lines +2117 to +2133
let output = result.stdout_str().trim();

// Find positions of key components
let year_pos = output.find("2025").expect("Should contain year");
let time_pos = output.find("13:00").expect("Should contain time");
let tz_pos = output
.find("CEST")
.or_else(|| output.find("CET"))
.expect("Should contain timezone");

// Timezone should be near time, not between date and year
// Valid: "Oct 11 2025 13:00:00 CEST" or "Oct 11 13:00:00 CEST 2025"
// Invalid: "Oct 11 CEST 2025 13:00:00"
assert!(
tz_pos >= time_pos || tz_pos > year_pos,
"Timezone should appear after time or after year, not between them. Got: {output}"
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use stdout_is("Sat Oct 11 13:00:00 CEST 2025\n")? Or am I missing something?

Copilot AI lite review requested due to automatic review settings September 26, 2026 11:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@sylvestre
sylvestre merged commit 3f9a7f5 into uutils:main Oct 9, 2026
125 of 126 checks passed
@sylvestre
sylvestre deleted the date-locale-hour branch October 9, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants