Repository navigation
date: add test for locale default format timezone position - #10983
Merged
Merged
Conversation
|
GNU testsuite comparison: |
cakebaker
reviewed
Feb 22, 2026
| // 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") |
Contributor
There was a problem hiding this comment.
Why not use C? That would allow you to use succeeds() instead of run() and to get rid of lines 2112 - 2115.
cakebaker
reviewed
Feb 22, 2026
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}" | ||
| ); |
Contributor
There was a problem hiding this comment.
Why not use stdout_is("Sat Oct 11 13:00:00 CEST 2025\n")? Or am I missing something?
sylvestre
force-pushed
the
date-locale-hour
branch
from
September 26, 2026 11:59
9cb0ec1 to
58fd19a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Covers date-locale-hour.sh
follow up #10935