aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-04-23 08:28:51 +0800
committerGitHub <noreply@github.com>2024-04-23 08:28:51 +0800
commit3305bb9e4175837f0fb37d46d93568da39067677 (patch)
treeba3ade3bfec17136aeeae0f517d4f4ab98e2b8b6
parent7508f1e607712cacc282faa6f742f9475741d90d (diff)
downloadrneovim-3305bb9e4175837f0fb37d46d93568da39067677.tar.gz
rneovim-3305bb9e4175837f0fb37d46d93568da39067677.tar.bz2
rneovim-3305bb9e4175837f0fb37d46d93568da39067677.zip
vim-patch:9.1.0364: tests: test_vim9_builtin is a bit slow (#28466)
Problem: tests: test_vim9_builtin is a bit slow Solution: source tests from a buffer instead of writing and sourcing a file (Yegappan Lakshmanan) closes: vim/vim#14614 https://github.com/vim/vim/commit/22697b6179e38f3d321b1495ef17f06031a9c8f1 N/A patch: vim-patch:9.1.0299: Vim9: return type not set for a lambda assigned to script var Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
-rw-r--r--test/old/testdir/test_winfixbuf.vim4
-rw-r--r--test/old/testdir/vim9.vim136
2 files changed, 95 insertions, 45 deletions
diff --git a/test/old/testdir/test_winfixbuf.vim b/test/old/testdir/test_winfixbuf.vim
index d371af9970..b41eaf3c9b 100644
--- a/test/old/testdir/test_winfixbuf.vim
+++ b/test/old/testdir/test_winfixbuf.vim
@@ -2776,11 +2776,11 @@ func Test_short_option()
call s:make_buffer_pairs()
set winfixbuf
- call assert_fails("edit something_else", "E1513")
+ call assert_fails("edit something_else", "E1513:")
set nowinfixbuf
set wfb
- call assert_fails("edit another_place", "E1513")
+ call assert_fails("edit another_place", "E1513:")
set nowfb
edit last_place
diff --git a/test/old/testdir/vim9.vim b/test/old/testdir/vim9.vim
index 218fab6c5e..7d1eec7d4f 100644
--- a/test/old/testdir/vim9.vim
+++ b/test/old/testdir/vim9.vim
@@ -46,49 +46,6 @@ func CheckScriptSuccess(lines)
endtry
endfunc
-" :source a list of "lines" and check whether it fails with "error"
-func CheckSourceFailure(lines, error, lnum = -3)
- if get(a:lines, 0, '') ==# 'vim9script'
- return
- endif
- new
- call setline(1, a:lines)
- try
- call assert_fails('source', a:error, a:lines, a:lnum)
- finally
- bw!
- endtry
-endfunc
-
-" :source a list of "lines" and check whether it fails with the list of
-" "errors"
-func CheckSourceFailureList(lines, errors, lnum = -3)
- if get(a:lines, 0, '') ==# 'vim9script'
- return
- endif
- new
- call setline(1, a:lines)
- try
- call assert_fails('source', a:errors, a:lines, a:lnum)
- finally
- bw!
- endtry
-endfunc
-
-" :source a list of "lines" and check whether it succeeds
-func CheckSourceSuccess(lines)
- if get(a:lines, 0, '') ==# 'vim9script'
- return
- endif
- new
- call setline(1, a:lines)
- try
- :source
- finally
- bw!
- endtry
-endfunc
-
func CheckDefAndScriptSuccess(lines)
return
endfunc
@@ -185,3 +142,96 @@ func CheckLegacyAndVim9Failure(lines, error)
\ })
call CheckLegacyFailure(legacylines, legacyError)
endfunc
+
+" :source a list of "lines" and check whether it fails with "error"
+func CheckSourceScriptFailure(lines, error, lnum = -3)
+ if get(a:lines, 0, '') ==# 'vim9script'
+ return
+ endif
+ let cwd = getcwd()
+ new
+ call setline(1, a:lines)
+ let bnr = bufnr()
+ try
+ call assert_fails('source', a:error, a:lines, a:lnum)
+ finally
+ call chdir(cwd)
+ exe $':bw! {bnr}'
+ endtry
+endfunc
+
+" :source a list of "lines" and check whether it fails with the list of
+" "errors"
+func CheckSourceScriptFailureList(lines, errors, lnum = -3)
+ if get(a:lines, 0, '') ==# 'vim9script'
+ return
+ endif
+ let cwd = getcwd()
+ new
+ let bnr = bufnr()
+ call setline(1, a:lines)
+ try
+ call assert_fails('source', a:errors, a:lines, a:lnum)
+ finally
+ call chdir(cwd)
+ exe $':bw! {bnr}'
+ endtry
+endfunc
+
+" :source a list of "lines" and check whether it succeeds
+func CheckSourceScriptSuccess(lines)
+ if get(a:lines, 0, '') ==# 'vim9script'
+ return
+ endif
+ let cwd = getcwd()
+ new
+ let bnr = bufnr()
+ call setline(1, a:lines)
+ try
+ :source
+ finally
+ call chdir(cwd)
+ exe $':bw! {bnr}'
+ endtry
+endfunc
+
+func CheckSourceSuccess(lines)
+ call CheckSourceScriptSuccess(a:lines)
+endfunc
+
+func CheckSourceFailure(lines, error, lnum = -3)
+ call CheckSourceScriptFailure(a:lines, a:error, a:lnum)
+endfunc
+
+func CheckSourceFailureList(lines, errors, lnum = -3)
+ call CheckSourceScriptFailureList(a:lines, a:errors, a:lnum)
+endfunc
+
+func CheckSourceDefSuccess(lines)
+ return
+endfunc
+
+func CheckSourceDefAndScriptSuccess(lines)
+ return
+endfunc
+
+func CheckSourceDefCompileSuccess(lines)
+ return
+endfunc
+
+func CheckSourceDefFailure(lines, error, lnum = -3)
+ return
+endfunc
+
+func CheckSourceDefExecFailure(lines, error, lnum = -3)
+ return
+endfunc
+
+func CheckSourceDefAndScriptFailure(lines, error, lnum = -3)
+ return
+endfunc
+
+func CheckSourceDefExecAndScriptFailure(lines, error, lnum = -3)
+ return
+endfunc
+