diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-12-06 01:15:43 -0500 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-03-27 10:53:41 -0400 |
commit | 3261ba98a2c0f7644bbaf7890a3906c42cfdb807 (patch) | |
tree | 1403fc412517c2dc9f88b703f84a4d165b1fa0f5 /src/nvim/testdir | |
parent | 75a9db5b7d60c016a950dac7f0a0932e7d7c6df8 (diff) | |
download | rneovim-3261ba98a2c0f7644bbaf7890a3906c42cfdb807.tar.gz rneovim-3261ba98a2c0f7644bbaf7890a3906c42cfdb807.tar.bz2 rneovim-3261ba98a2c0f7644bbaf7890a3906c42cfdb807.zip |
vim-patch:8.1.2326: cannot parse a date/time string
Problem: Cannot parse a date/time string.
Solution: Add strptime(). (Stephen Wall, closes #)
https://github.com/vim/vim/commit/10455d43fef041309ce0613fa792c635dd71e3a8
N/A patches for version.c:
vim-patch:8.1.2344: Cygwin: warning for using strptime()
Problem: Cygwin: warning for using strptime().
Solution: Move defining _XOPEN_SOURCE and __USE_XOPEN to vim.h. (Ken Takata,
closes vim/vim#5265) Use 700 for _XOPEN_SOURCE for mkdtemp().
https://github.com/vim/vim/commit/6a228c6463935a73c8f21142cb7368545cfee317
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r-- | src/nvim/testdir/test_functions.vim | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index 5dae8d681a..5efd27d016 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,28 @@ func Test_strftime() endif endfunc +func Test_strptime() + CheckFunction strptime + + if exists('$TZ') + let tz = $TZ + endif + let $TZ = 'UTC' + + call assert_equal(1484653763, strptime('%Y-%m-%d %X', '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 |