diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/api/buffer_spec.lua | 19 | ||||
-rw-r--r-- | test/functional/eval/backtick_expansion_spec.lua | 42 | ||||
-rw-r--r-- | test/functional/terminal/buffer_spec.lua | 4 |
3 files changed, 61 insertions, 4 deletions
diff --git a/test/functional/api/buffer_spec.lua b/test/functional/api/buffer_spec.lua index e7e2168238..552e3a8564 100644 --- a/test/functional/api/buffer_spec.lua +++ b/test/functional/api/buffer_spec.lua @@ -4,6 +4,9 @@ local curbuf, curwin, eq = helpers.curbuf, helpers.curwin, helpers.eq local curbufmeths, ok = helpers.curbufmeths, helpers.ok local funcs = helpers.funcs local request = helpers.request +local exc_exec = helpers.exc_exec +local execute = helpers.execute +local insert = helpers.insert local NIL = helpers.NIL local meth_pcall = helpers.meth_pcall local command = helpers.command @@ -242,6 +245,22 @@ describe('api/buf', function() eq({'e', 'a', 'b', 'c', 'd'}, get_lines(0, -1, true)) end) + it("set_line on alternate buffer does not access invalid line (E315)", function() + execute('set hidden') + insert('Initial file') + command('enew') + insert([[ + More + Lines + Than + In + The + Other + Buffer]]) + execute('$') + local retval = exc_exec("call nvim_buf_set_lines(1, 0, 1, v:false, ['test'])") + eq(0, retval) + end) end) describe('{get,set,del}_var', function() diff --git a/test/functional/eval/backtick_expansion_spec.lua b/test/functional/eval/backtick_expansion_spec.lua new file mode 100644 index 0000000000..81e8e295fa --- /dev/null +++ b/test/functional/eval/backtick_expansion_spec.lua @@ -0,0 +1,42 @@ +local lfs = require('lfs') +local helpers = require('test.functional.helpers')(after_each) +local clear, command, eval, eq = helpers.clear, helpers.command, helpers.eval, helpers.eq +local write_file = helpers.write_file + +describe("backtick expansion", function() + setup(function() + clear() + lfs.mkdir("test-backticks") + write_file("test-backticks/file1", "test file 1") + write_file("test-backticks/file2", "test file 2") + write_file("test-backticks/file3", "test file 3") + lfs.mkdir("test-backticks/subdir") + write_file("test-backticks/subdir/file4", "test file 4") + -- Long path might cause "Press ENTER" prompt; use :silent to avoid it. + command('silent cd test-backticks') + end) + + teardown(function() + helpers.rmdir('test-backticks') + end) + + it("with default 'shell'", function() + if helpers.pending_win32(pending) then return end -- Need win32 shell fixes + command(":silent args `echo ***2`") + eq({ "file2", }, eval("argv()")) + command(":silent args `echo */*4`") + eq({ "subdir/file4", }, eval("argv()")) + end) + + it("with shell=fish", function() + if eval("executable('fish')") == 0 then + pending('missing "fish" command') + return + end + command("set shell=fish") + command(":silent args `echo ***2`") + eq({ "file2", }, eval("argv()")) + command(":silent args `echo */*4`") + eq({ "subdir/file4", }, eval("argv()")) + end) +end) diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index b61eef948d..129390a7a5 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -198,10 +198,6 @@ describe('terminal buffer', function() end) it('term_close() use-after-free #4393', function() - if eval("executable('yes')") == 0 then - pending('missing "yes" command') - return - end execute('terminal yes') feed([[<C-\><C-n>]]) execute('bdelete!') |