From c554e989786be30fa306efcd7e504ba7cb97cb3b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 28 Feb 2023 13:30:08 +0800 Subject: vim-patch:8.2.2765: Vim9: not all blob operations work Problem: Vim9: not all blob operations work. Solution: Run more tests also with Vim9 script and :def functions. Fix what doesn't work. https://github.com/vim/vim/commit/0e3ff1919603ee4c4a347fdf761dbdbdeb068015 Co-authored-by: Bram Moolenaar --- src/nvim/testdir/vim9.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/testdir/vim9.vim') diff --git a/src/nvim/testdir/vim9.vim b/src/nvim/testdir/vim9.vim index 3c0ff2b2dd..e1343d51f1 100644 --- a/src/nvim/testdir/vim9.vim +++ b/src/nvim/testdir/vim9.vim @@ -98,9 +98,9 @@ endfunc " Use ' #"' for a comment func CheckLegacyAndVim9Failure(lines, error) if type(a:error) == type('string') - let legacyError = error + let legacyError = a:error else - let legacyError = error[0] + let legacyError = a:error[0] endif let legacylines = a:lines->deepcopy()->map({_, v -> -- cgit From 88b70e7d4650795210222a598cbb233bf7fc98f8 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 28 Feb 2023 15:50:35 +0800 Subject: vim-patch:8.2.2782: Vim9: blob operations not fully tested Problem: Vim9: blob operations not fully tested. Solution: Make more blob tests run in Vim9 script. Fix filter(). Make insert() give an error for a null blob, like add(). https://github.com/vim/vim/commit/39211cba723a2cb58a97c7e08826713164b86efc vim-patch:8.2.3284: no error for insert() or remove() changing a locked blob Problem: No error for insert() or remove() changing a locked blob. Solution: Check a blob is not locked before changing it. (Sean Dewar, closes vim/vim#8696) https://github.com/vim/vim/commit/80d7395dcfe96158428da6bb3d28a6eee1244e28 Co-authored-by: Bram Moolenaar Co-authored-by: Sean Dewar --- src/nvim/testdir/vim9.vim | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/nvim/testdir/vim9.vim') diff --git a/src/nvim/testdir/vim9.vim b/src/nvim/testdir/vim9.vim index e1343d51f1..2cc3d88aa8 100644 --- a/src/nvim/testdir/vim9.vim +++ b/src/nvim/testdir/vim9.vim @@ -34,6 +34,10 @@ func CheckScriptSuccess(lines) endtry endfunc +func CheckDefExecAndScriptFailure(lines, error, lnum = -3) + return +endfunc + " Check that "lines" inside a legacy function has no error. func CheckLegacySuccess(lines) let cwd = getcwd() -- cgit From af23d173883f47fd02a9a380c719e4428370b484 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Tue, 7 Mar 2023 04:13:04 +0100 Subject: test: move oldtests to test directory (#22536) The new oldtest directory is in test/old/testdir. The reason for this is that many tests have hardcoded the parent directory name to be 'testdir'. --- src/nvim/testdir/vim9.vim | 116 ---------------------------------------------- 1 file changed, 116 deletions(-) delete mode 100644 src/nvim/testdir/vim9.vim (limited to 'src/nvim/testdir/vim9.vim') diff --git a/src/nvim/testdir/vim9.vim b/src/nvim/testdir/vim9.vim deleted file mode 100644 index 2cc3d88aa8..0000000000 --- a/src/nvim/testdir/vim9.vim +++ /dev/null @@ -1,116 +0,0 @@ - -" Use a different file name for each run. -let s:sequence = 1 - -func CheckScriptFailure(lines, error, lnum = -3) - if get(a:lines, 0, '') ==# 'vim9script' - return - endif - let cwd = getcwd() - let fname = 'XScriptFailure' .. s:sequence - let s:sequence += 1 - call writefile(a:lines, fname) - try - call assert_fails('so ' .. fname, a:error, a:lines, a:lnum) - finally - call chdir(cwd) - call delete(fname) - endtry -endfunc - -func CheckScriptSuccess(lines) - if get(a:lines, 0, '') ==# 'vim9script' - return - endif - let cwd = getcwd() - let fname = 'XScriptSuccess' .. s:sequence - let s:sequence += 1 - call writefile(a:lines, fname) - try - exe 'so ' .. fname - finally - call chdir(cwd) - call delete(fname) - endtry -endfunc - -func CheckDefExecAndScriptFailure(lines, error, lnum = -3) - return -endfunc - -" Check that "lines" inside a legacy function has no error. -func CheckLegacySuccess(lines) - let cwd = getcwd() - let fname = 'XlegacySuccess' .. s:sequence - let s:sequence += 1 - call writefile(['func Func()'] + a:lines + ['endfunc'], fname) - try - exe 'so ' .. fname - call Func() - finally - delfunc! Func - call chdir(cwd) - call delete(fname) - endtry -endfunc - -" Check that "lines" inside a legacy function results in the expected error -func CheckLegacyFailure(lines, error) - let cwd = getcwd() - let fname = 'XlegacyFails' .. s:sequence - let s:sequence += 1 - call writefile(['func Func()'] + a:lines + ['endfunc', 'call Func()'], fname) - try - call assert_fails('so ' .. fname, a:error) - finally - delfunc! Func - call chdir(cwd) - call delete(fname) - endtry -endfunc - -" Execute "lines" in a legacy function, translated as in -" CheckLegacyAndVim9Success() -func CheckTransLegacySuccess(lines) - let legacylines = a:lines->deepcopy()->map({_, v -> - \ v->substitute('\', 'let', 'g') - \ ->substitute('\', 'let', 'g') - \ ->substitute('\', '{', 'g') - \ ->substitute('\', '->', 'g') - \ ->substitute('\', '}', 'g') - \ ->substitute('\', '1', 'g') - \ ->substitute('\', '0', 'g') - \ ->substitute('#"', ' "', 'g') - \ }) - call CheckLegacySuccess(legacylines) -endfunc - -" Execute "lines" in a legacy function -" Use 'VAR' for a declaration. -" Use 'LET' for an assignment -" Use ' #"' for a comment -" Use LSTART arg LMIDDLE expr LEND for lambda -" Use 'TRUE' for 1 -" Use 'FALSE' for 0 -func CheckLegacyAndVim9Success(lines) - call CheckTransLegacySuccess(a:lines) -endfunc - -" Execute "lines" in a legacy function -" Use 'VAR' for a declaration. -" Use 'LET' for an assignment -" Use ' #"' for a comment -func CheckLegacyAndVim9Failure(lines, error) - if type(a:error) == type('string') - let legacyError = a:error - else - let legacyError = a:error[0] - endif - - let legacylines = a:lines->deepcopy()->map({_, v -> - \ v->substitute('\', 'let', 'g') - \ ->substitute('\', 'let', 'g') - \ ->substitute('#"', ' "', 'g') - \ }) - call CheckLegacyFailure(legacylines, legacyError) -endfunc -- cgit