aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_functions.vim
diff options
context:
space:
mode:
authorMatthieu Coudron <mattator@gmail.com>2020-04-12 20:37:57 +0200
committerGitHub <noreply@github.com>2020-04-12 20:37:57 +0200
commit46fdad255ead9ca484a6e512efe13b379b8fc8ab (patch)
tree9d0ecdf08a98c7ac179ebf93a3f2e3d6c53fec33 /src/nvim/testdir/test_functions.vim
parent1f56f9a4b32c7d7aebafea226c148e9ed8bbabdb (diff)
parent53fdd76181d2d1834aa38f4b47aa36f844d1e43f (diff)
downloadrneovim-46fdad255ead9ca484a6e512efe13b379b8fc8ab.tar.gz
rneovim-46fdad255ead9ca484a6e512efe13b379b8fc8ab.tar.bz2
rneovim-46fdad255ead9ca484a6e512efe13b379b8fc8ab.zip
Merge pull request #12033 from janlazo/vim-8.1.1313
[RFC]vim-patch:8.1.{1313,1567,1568}
Diffstat (limited to 'src/nvim/testdir/test_functions.vim')
-rw-r--r--src/nvim/testdir/test_functions.vim26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim
index 7822507f86..b75b095841 100644
--- a/src/nvim/testdir/test_functions.vim
+++ b/src/nvim/testdir/test_functions.vim
@@ -186,6 +186,32 @@ func Test_strftime()
call assert_fails('call strftime([])', 'E730:')
call assert_fails('call strftime("%Y", [])', 'E745:')
+
+ " Check that the time changes after we change the timezone
+ " Save previous timezone value, if any
+ if exists('$TZ')
+ let tz = $TZ
+ endif
+
+ " Force EST and then UTC, save the current hour (24-hour clock) for each
+ let $TZ = 'EST' | let est = strftime('%H')
+ let $TZ = 'UTC' | let utc = strftime('%H')
+
+ " Those hours should be two bytes long, and should not be the same; if they
+ " are, a tzset(3) call may have failed somewhere
+ call assert_equal(strlen(est), 2)
+ call assert_equal(strlen(utc), 2)
+ " TODO: this fails on MS-Windows
+ if has('unix')
+ call assert_notequal(est, utc)
+ endif
+
+ " If we cached a timezone value, put it back, otherwise clear it
+ if exists('tz')
+ let $TZ = tz
+ else
+ unlet $TZ
+ endif
endfunc
func Test_resolve()