aboutsummaryrefslogtreecommitdiff
path: root/test/old/testdir/vim9.vim
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-05-24 19:18:11 +0000
committerJosh Rahm <joshuarahm@gmail.com>2024-05-24 19:18:11 +0000
commitff7ed8f586589d620a806c3758fac4a47a8e7e15 (patch)
tree729bbcb92231538fa61dab6c3d890b025484b7f5 /test/old/testdir/vim9.vim
parent376914f419eb08fdf4c1a63a77e1f035898a0f10 (diff)
parent28c04948a1c887a1cc0cb64de79fa32631700466 (diff)
downloadrneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.gz
rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.bz2
rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'test/old/testdir/vim9.vim')
-rw-r--r--test/old/testdir/vim9.vim136
1 files changed, 93 insertions, 43 deletions
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
+