aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-03-27 11:29:32 -0400
committerGitHub <noreply@github.com>2021-03-27 11:29:32 -0400
commitacd643bd496a3c76ff99a9952d493a16cd2861d6 (patch)
treedefcac55febffa177c437886bd861f2fa68d9748 /src/nvim/testdir
parent75a9db5b7d60c016a950dac7f0a0932e7d7c6df8 (diff)
parent423f3bc3e2d6aa8245a2cda1c4e7663387383ab7 (diff)
downloadrneovim-acd643bd496a3c76ff99a9952d493a16cd2861d6.tar.gz
rneovim-acd643bd496a3c76ff99a9952d493a16cd2861d6.tar.bz2
rneovim-acd643bd496a3c76ff99a9952d493a16cd2861d6.zip
Merge pull request #13621 from janlazo/vim-8.1.2326
vim-patch:8.1.{2326,2344,2398},8.2.0949
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_functions.vim34
1 files changed, 31 insertions, 3 deletions
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim
index 5dae8d681a..555f549743 100644
--- a/src/nvim/testdir/test_functions.vim
+++ b/src/nvim/testdir/test_functions.vim
@@ -1,5 +1,7 @@
" Tests for various functions.
+
source shared.vim
+source check.vim
" Must be done first, since the alternate buffer must be unset.
func Test_00_bufexists()
@@ -171,9 +173,8 @@ func Test_str2nr()
endfunc
func Test_strftime()
- if !exists('*strftime')
- return
- endif
+ CheckFunction strftime
+
" Format of strftime() depends on system. We assume
" that basic formats tested here are available and
" identical on all systems which support strftime().
@@ -214,6 +215,33 @@ func Test_strftime()
endif
endfunc
+func Test_strptime()
+ CheckFunction strptime
+ CheckNotMSWindows
+
+ if exists('$TZ')
+ let tz = $TZ
+ endif
+ let $TZ = 'UTC'
+
+ call assert_equal(1484653763, strptime('%Y-%m-%d %T', '2017-01-17 11:49:23'))
+
+ " Force DST and check that it's considered
+ let $TZ = 'WINTER0SUMMER,J1,J365'
+ call assert_equal(1484653763 - 3600, strptime('%Y-%m-%d %T', '2017-01-17 11:49:23'))
+
+ call assert_fails('call strptime()', 'E119:')
+ call assert_fails('call strptime("xxx")', 'E119:')
+ call assert_equal(0, strptime("%Y", ''))
+ call assert_equal(0, strptime("%Y", "xxx"))
+
+ if exists('tz')
+ let $TZ = tz
+ else
+ unlet $TZ
+ endif
+endfunc
+
func Test_resolve_unix()
if !has('unix')
return