diff options
author | ZyX <kp-pav@yandex.ru> | 2017-01-29 19:51:55 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-03-27 00:12:42 +0300 |
commit | dcb992ab3759b604c1824913002714a018be0532 (patch) | |
tree | db7b6a205518c504685782e73df5b59ca06fd4cb /test/functional/lua/commands_spec.lua | |
parent | 295e7607c472b49e8c0762977e38c4527b746b6f (diff) | |
download | rneovim-dcb992ab3759b604c1824913002714a018be0532.tar.gz rneovim-dcb992ab3759b604c1824913002714a018be0532.tar.bz2 rneovim-dcb992ab3759b604c1824913002714a018be0532.zip |
executor: Add :luafile command
Diffstat (limited to 'test/functional/lua/commands_spec.lua')
-rw-r--r-- | test/functional/lua/commands_spec.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/functional/lua/commands_spec.lua b/test/functional/lua/commands_spec.lua index 41a5a8d9e0..80fac07f8c 100644 --- a/test/functional/lua/commands_spec.lua +++ b/test/functional/lua/commands_spec.lua @@ -9,6 +9,7 @@ local funcs = helpers.funcs local source = helpers.source local dedent = helpers.dedent local exc_exec = helpers.exc_exec +local write_file = helpers.write_file local redir_exec = helpers.redir_exec local curbufmeths = helpers.curbufmeths @@ -121,3 +122,30 @@ describe(':luado command', function() eq({s}, curbufmeths.get_lines(0, -1, false)) end) end) + +describe(':luafile', function() + local fname = 'Xtest-functional-lua-commands-luafile' + + after_each(function() + os.remove(fname) + end) + + it('works', function() + write_file(fname, [[ + vim.api.nvim_buf_set_lines(1, 1, 2, false, {"ETTS"}) + vim.api.nvim_buf_set_lines(1, 2, 3, false, {"TTSE"}) + vim.api.nvim_buf_set_lines(1, 3, 4, false, {"STTE"}) + ]]) + eq('', redir_exec('luafile ' .. fname)) + eq({'', 'ETTS', 'TTSE', 'STTE'}, curbufmeths.get_lines(0, 100, false)) + end) + + it('correctly errors out', function() + write_file(fname, '()') + eq(("Vim(luafile):E5112: Error while creating lua chunk: %s:1: unexpected symbol near ')'"):format(fname), + exc_exec('luafile ' .. fname)) + write_file(fname, 'vimm.api.nvim_buf_set_lines(1, 1, 2, false, {"ETTS"})') + eq(("Vim(luafile):E5113: Error while calling lua chunk: %s:1: attempt to index global 'vimm' (a nil value)"):format(fname), + exc_exec('luafile ' .. fname)) + end) +end) |