Skip to content

fix: make tz_name tests deterministic across DST transitions#59

Draft
Koan-Bot wants to merge 1 commit intoatoomic:mainfrom
Koan-Bot:koan.atoomic/fix-tz-name-dst-test
Draft

fix: make tz_name tests deterministic across DST transitions#59
Koan-Bot wants to merge 1 commit intoatoomic:mainfrom
Koan-Bot:koan.atoomic/fix-tz-name-dst-test

Conversation

@Koan-Bot
Copy link

@Koan-Bot Koan-Bot commented Mar 13, 2026

What

Fix t/zone.t test failure that occurs every spring when DST starts.

Why

tz_name(-18000) defaults its $dst parameter from localtime(), returning "cdt" during DST months instead of the expected "est". The test hardcoded EST, making it fail predictably every March. Reported in #58.

How

Replaced the implicit-DST tz_name test with explicit $dst parameter calls — tz_name(-18000, 0) for standard time, tz_name(-18000, 1) for daylight. This tests the actual disambiguation logic while being deterministic regardless of when the suite runs.

Also expanded tz_name coverage: both DST states for shared offsets, single-entry offsets (JST, PST, PDT), offset-0 with both flags, and unknown-offset numeric fallback. 34 tests total (up from 28).

Testing

prove -l t/ — 913 tests pass (all 8 test files).

Fixes #58


Quality Report

Changes: 1 file changed, 20 insertions(+), 4 deletions(-)

Code scan: clean

Tests: skipped

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

tz_name() defaults its $dst parameter from localtime(), so
tz_name(-18000) returns "cdt" during DST months and "est" outside.
The test hardcoded the EST expectation, causing failures every spring.

Replace the fragile implicit-DST test with explicit $dst parameter
tests that produce the same result regardless of when they run.
Also expand tz_name coverage: both DST states, multiple offsets,
and unknown-offset numeric fallback (34 tests, up from 28).

Fixes atoomic#58
@timlegge
Copy link

seems to fix the issue I had with ADT set as the timezone

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.

test failure after daylight savings time started

3 participants