From d79164c9f9ffbb17b82b3a523e217e61f43697be Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 16 Nov 2019 03:34:25 -0500 Subject: vim-patch:8.1.0992: :normal resets reg_executing() result #11398 Problem: A :normal command while executing a register resets the reg_executing() result. Solution: Save and restore reg_executing. (closes vim/vim#4066) https://github.com/vim/vim/commit/cce713ddcc0c9ab29926c28e287cbb587a959b08 --- src/nvim/testdir/test_functions.vim | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/nvim/testdir/test_functions.vim') diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index a36c51f56f..7822507f86 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -1132,6 +1132,13 @@ func Test_reg_executing_and_recording() " :normal command saves and restores reg_executing let s:reg_stat = '' + let @q = ":call TestFunc()\:call s:save_reg_stat()\" + func TestFunc() abort + normal! ia + endfunc + call feedkeys("@q", 'xt') + call assert_equal(':q', s:reg_stat) + delfunc TestFunc " getchar() command saves and restores reg_executing map W :call TestFunc() -- cgit From 10c5434f9c1219d480fd07e711838e22dc912bba Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 29 Mar 2020 11:59:22 -0400 Subject: vim-patch:8.1.1567: localtime_r() does not respond to $TZ changes Problem: Localtime_r() does not respond to $TZ changes. Solution: If $TZ changes then call tzset(). (Tom Ryder) https://github.com/vim/vim/commit/db51730df1817fc4b6ecf5a065c69fac518ad821 --- src/nvim/testdir/test_functions.vim | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/nvim/testdir/test_functions.vim') diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index 7822507f86..da5edbaea1 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -186,6 +186,29 @@ 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) + call assert_notequal(est, utc) + + " 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() -- cgit From 53fdd76181d2d1834aa38f4b47aa36f844d1e43f Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 29 Mar 2020 14:17:52 -0400 Subject: vim-patch:8.1.1568: strftime() test fails on MS-Windows Problem: Strftime() test fails on MS-Windows. Solution: Skip the check for using the $TZ environment variable. https://github.com/vim/vim/commit/87652a7e3b94755084944afec51a0bfcd8b0a0c3 --- src/nvim/testdir/test_functions.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir/test_functions.vim') diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index da5edbaea1..b75b095841 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -201,7 +201,10 @@ func Test_strftime() " are, a tzset(3) call may have failed somewhere call assert_equal(strlen(est), 2) call assert_equal(strlen(utc), 2) - call assert_notequal(est, utc) + " 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') -- cgit From 572627255983b7733b6ad05da52b3e704aae8a2f Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 3 Apr 2020 20:36:11 -0400 Subject: vim-patch:8.2.0507: getbufvar() may get the wrong dictionary Problem: Getbufvar() may get the wrong dictionary. (David le Blanc) Solution: Check for empty name. (closes vim/vim#5878) https://github.com/vim/vim/commit/5259275347667a90fb88d8ea74331f88ad68edfc --- src/nvim/testdir/test_functions.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/nvim/testdir/test_functions.vim') diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index b75b095841..bd5cb6ad19 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -666,6 +666,16 @@ func Test_getbufvar() call assert_equal('iso-8859-2', getbufvar(bufnr('%'), '&fenc')) close + " Get the b: dict. + let b:testvar = 'one' + new + let b:testvar = 'two' + let thebuf = bufnr() + wincmd w + call assert_equal('two', getbufvar(thebuf, 'testvar')) + call assert_equal('two', getbufvar(thebuf, '').testvar) + bwipe! + set fileformats& endfunc -- cgit From d2766b06c8fc50d06765c5c607744cc6b5f5ef0a Mon Sep 17 00:00:00 2001 From: Hennadii Chernyshchyk Date: Tue, 5 May 2020 18:15:45 +0300 Subject: vim-patch:8.1.1120: cannot easily get directory entry matches #12222 Problem: Cannot easily get directory entry matches. Solution: Add the readdir() function. (Yasuhiro Matsumoto, closes vim/vim#2439) https://github.com/vim/vim/commit/543c9b1921d7605498b54afdef518e312f1b4515 closes #12212 --- src/nvim/testdir/test_functions.vim | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/nvim/testdir/test_functions.vim') diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index bd5cb6ad19..51689db9c4 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -1307,3 +1307,33 @@ func Test_bufadd_bufload() bwipe otherName call assert_equal(0, bufexists('someName')) endfunc + +func Test_readdir() + call mkdir('Xdir') + call writefile([], 'Xdir/foo.txt') + call writefile([], 'Xdir/bar.txt') + call mkdir('Xdir/dir') + + " All results + let files = readdir('Xdir') + call assert_equal(['bar.txt', 'dir', 'foo.txt'], sort(files)) + + " Only results containing "f" + let files = readdir('Xdir', { x -> stridx(x, 'f') !=- 1 }) + call assert_equal(['foo.txt'], sort(files)) + + " Only .txt files + let files = readdir('Xdir', { x -> x =~ '.txt$' }) + call assert_equal(['bar.txt', 'foo.txt'], sort(files)) + + " Only .txt files with string + let files = readdir('Xdir', 'v:val =~ ".txt$"') + call assert_equal(['bar.txt', 'foo.txt'], sort(files)) + + " Limit to 1 result. + let l = [] + let files = readdir('Xdir', {x -> len(add(l, x)) == 2 ? -1 : 1}) + call assert_equal(1, len(files)) + + call delete('Xdir', 'rf') +endfunc -- cgit