Skip to content

Commit ea997ed

Browse files
jamessanchrisbra
authored andcommitted
patch 9.1.0776: test_strftime may fail because of missing TZ data
Problem: test_strftime may fail because of missing TZ data Solution: Use GMT offsets to validate timezone differences (James McCoy) Some systems only provide timezones that follow the geographical region naming (e.g. America/New_York) by default and require an additional install for other names (like EST). The GMT+<offset> format must always be honored, so use that to generate distinct data for the test. closes: #15848 Signed-off-by: James McCoy <jamessan@jamessan.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 59086a2 commit ea997ed

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/testdir/test_functions.vim

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,17 +277,17 @@ func Test_strftime()
277277
let tz = $TZ
278278
endif
279279

280-
" Force EST and then UTC, save the current hour (24-hour clock) for each
281-
let $TZ = 'EST' | let est = strftime('%H')
282-
let $TZ = 'UTC' | let utc = strftime('%H')
280+
" Force different time zones, save the current hour (24-hour clock) for each
281+
let $TZ = 'GMT+1' | let one = strftime('%H')
282+
let $TZ = 'GMT+2' | let two = strftime('%H')
283283

284284
" Those hours should be two bytes long, and should not be the same; if they
285285
" are, a tzset(3) call may have failed somewhere
286-
call assert_equal(strlen(est), 2)
287-
call assert_equal(strlen(utc), 2)
286+
call assert_equal(strlen(one), 2)
287+
call assert_equal(strlen(two), 2)
288288
" TODO: this fails on MS-Windows
289289
if has('unix')
290-
call assert_notequal(est, utc)
290+
call assert_notequal(one, two)
291291
endif
292292

293293
" If we cached a timezone value, put it back, otherwise clear it

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
776,
707709
/**/
708710
775,
709711
/**/

0 commit comments

Comments
 (0)