aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/vim9.vim
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-11-30 20:35:25 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-11-30 20:35:25 +0000
commit1b7b916b7631ddf73c38e3a0070d64e4636cb2f3 (patch)
treecd08258054db80bb9a11b1061bb091c70b76926a /src/nvim/testdir/vim9.vim
parenteaa89c11d0f8aefbb512de769c6c82f61a8baca3 (diff)
parent4a8bf24ac690004aedf5540fa440e788459e5e34 (diff)
downloadrneovim-aucmd_textputpost.tar.gz
rneovim-aucmd_textputpost.tar.bz2
rneovim-aucmd_textputpost.zip
Merge remote-tracking branch 'upstream/master' into aucmd_textputpostaucmd_textputpost
Diffstat (limited to 'src/nvim/testdir/vim9.vim')
-rw-r--r--src/nvim/testdir/vim9.vim112
1 files changed, 0 insertions, 112 deletions
diff --git a/src/nvim/testdir/vim9.vim b/src/nvim/testdir/vim9.vim
deleted file mode 100644
index 3c0ff2b2dd..0000000000
--- a/src/nvim/testdir/vim9.vim
+++ /dev/null
@@ -1,112 +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
-
-" 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('\<VAR\>', 'let', 'g')
- \ ->substitute('\<LET\>', 'let', 'g')
- \ ->substitute('\<LSTART\>', '{', 'g')
- \ ->substitute('\<LMIDDLE\>', '->', 'g')
- \ ->substitute('\<LEND\>', '}', 'g')
- \ ->substitute('\<TRUE\>', '1', 'g')
- \ ->substitute('\<FALSE\>', '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 = error
- else
- let legacyError = error[0]
- endif
-
- let legacylines = a:lines->deepcopy()->map({_, v ->
- \ v->substitute('\<VAR\>', 'let', 'g')
- \ ->substitute('\<LET\>', 'let', 'g')
- \ ->substitute('#"', ' "', 'g')
- \ })
- call CheckLegacyFailure(legacylines, legacyError)
-endfunc