diff options
| author | James McCoy <jamessan@jamessan.com> | 2020-07-31 17:59:48 -0400 | 
|---|---|---|
| committer | James McCoy <jamessan@jamessan.com> | 2020-07-31 17:59:48 -0400 | 
| commit | 228d7d948200563292f13723cdd0f947bd0c711c (patch) | |
| tree | e30ac7afb5cfc68470be42e8c5e02907fb44b99b /test/functional/terminal/buffer_spec.lua | |
| parent | 3e3002b90c46fca8d8d5edebc021e56d95c5e645 (diff) | |
| parent | 1153ac9036ab62ee25078248a01dc56a2311b9a6 (diff) | |
| download | rneovim-228d7d948200563292f13723cdd0f947bd0c711c.tar.gz rneovim-228d7d948200563292f13723cdd0f947bd0c711c.tar.bz2 rneovim-228d7d948200563292f13723cdd0f947bd0c711c.zip | |
Merge remote-tracking branch 'upstream/master' into fileinfo-garbage
Diffstat (limited to 'test/functional/terminal/buffer_spec.lua')
| -rw-r--r-- | test/functional/terminal/buffer_spec.lua | 46 | 
1 files changed, 42 insertions, 4 deletions
| diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index 1763574bf9..6372cd935e 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -5,6 +5,7 @@ local wait = helpers.wait  local eval, feed_command, source = helpers.eval, helpers.feed_command, helpers.source  local eq, neq = helpers.eq, helpers.neq  local write_file = helpers.write_file +local command= helpers.command  describe(':terminal buffer', function()    local screen @@ -16,6 +17,18 @@ describe(':terminal buffer', function()      screen = thelpers.screen_setup()    end) +  it('terminal-mode forces various options', function() +    feed([[<C-\><C-N>]]) +    command('setlocal cursorline cursorcolumn scrolloff=4 sidescrolloff=7') +    eq({ 1, 1, 4, 7 }, eval('[&l:cursorline, &l:cursorcolumn, &l:scrolloff, &l:sidescrolloff]')) +    eq('n', eval('mode()')) + +    -- Enter terminal-mode ("insert" mode in :terminal). +    feed('i') +    eq('t', eval('mode()')) +    eq({ 0, 0, 0, 0 }, eval('[&l:cursorline, &l:cursorcolumn, &l:scrolloff, &l:sidescrolloff]')) +  end) +    describe('when a new file is edited', function()      before_each(function()        feed('<c-\\><c-n>:set bufhidden=wipe<cr>:enew<cr>') @@ -59,7 +72,7 @@ describe(':terminal buffer', function()      end)      it('does not create swap files', function() -      local swapfile = nvim('command_output', 'swapname'):gsub('\n', '') +      local swapfile = nvim('exec', 'swapname', true):gsub('\n', '')        eq(nil, io.open(swapfile))      end) @@ -208,22 +221,38 @@ describe(':terminal buffer', function()        feed_command('terminal')        feed('<c-\\><c-n>')        feed_command('confirm bdelete') -      screen:expect{any='Close "term://', attr_ignore=true} +      screen:expect{any='Close "term://'}      end)      it('with &confirm', function()        feed_command('terminal')        feed('<c-\\><c-n>')        feed_command('bdelete') -      screen:expect{any='E89', attr_ignore=true} +      screen:expect{any='E89'}        feed('<cr>')        eq('terminal', eval('&buftype'))        feed_command('set confirm | bdelete') -      screen:expect{any='Close "term://', attr_ignore=true} +      screen:expect{any='Close "term://'}        feed('y')        neq('terminal', eval('&buftype'))      end)    end) + +  it('it works with set rightleft #11438', function() +    local columns = eval('&columns') +    feed(string.rep('a', columns)) +    command('set rightleft') +    screen:expect([[ +                                               ydaer ytt| +      {1:a}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| +                                                        | +                                                        | +                                                        | +                                                        | +      {3:-- TERMINAL --}                                    | +    ]]) +    command('bdelete!') +  end)  end)  describe('No heap-buffer-overflow when using', function() @@ -247,3 +276,12 @@ describe('No heap-buffer-overflow when using', function()      feed_command('bdelete!')    end)  end) + +describe('No heap-buffer-overflow when', function() +  it('set nowrap and send long line #11548', function() +    feed_command('set nowrap') +    feed_command('autocmd TermOpen * startinsert') +    feed_command('call feedkeys("4000ai\\<esc>:terminal!\\<cr>")') +    eq(2, eval('1+1')) +  end) +end) | 
