aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ex_cmds/script_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2022-03-27 10:25:55 -0700
committerGitHub <noreply@github.com>2022-03-27 10:25:55 -0700
commit72652cbc46f568128bfc296ba63fb2d26941da8e (patch)
tree45883e033228aacc55df313edb7acac1e1d76698 /test/functional/ex_cmds/script_spec.lua
parent05edab85d7edad63c3b449689b57f9f658782c11 (diff)
downloadrneovim-72652cbc46f568128bfc296ba63fb2d26941da8e.tar.gz
rneovim-72652cbc46f568128bfc296ba63fb2d26941da8e.tar.bz2
rneovim-72652cbc46f568128bfc296ba63fb2d26941da8e.zip
feat(test): use nvim_exec in helpers.source() #16064
helpers.source() was a hack to work around the lack of anonymous :source. Its "create tempfile" behavior is not a required part of most tests that use it. Some tests still need the old "create tempfile" behavior either because they test SID behavior, or because of missing nvim_exec features: #16071
Diffstat (limited to 'test/functional/ex_cmds/script_spec.lua')
-rw-r--r--test/functional/ex_cmds/script_spec.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/functional/ex_cmds/script_spec.lua b/test/functional/ex_cmds/script_spec.lua
index f249b9ba7c..bf69ada820 100644
--- a/test/functional/ex_cmds/script_spec.lua
+++ b/test/functional/ex_cmds/script_spec.lua
@@ -2,18 +2,30 @@ local helpers = require('test.functional.helpers')(after_each)
local eq = helpers.eq
local neq = helpers.neq
+local command = helpers.command
+local write_file = helpers.write_file
local meths = helpers.meths
local clear = helpers.clear
local dedent = helpers.dedent
-local source = helpers.source
local exc_exec = helpers.exc_exec
local missing_provider = helpers.missing_provider
+local tmpfile = 'X_ex_cmds_script'
+
before_each(clear)
+local function source(code)
+ write_file(tmpfile, code)
+ command('source '..tmpfile)
+end
+
describe('script_get-based command', function()
local garbage = ')}{+*({}]*[;(+}{&[]}{*])('
+ after_each(function()
+ os.remove(tmpfile)
+ end)
+
local function test_garbage_exec(cmd, check_neq)
describe(cmd, function()
it('works correctly when skipping oneline variant', function()