neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

matchparen_spec.lua (1173B)


      1 local t = require('test.testutil')
      2 local n = require('test.functional.testnvim')()
      3 local Screen = require('test.functional.ui.screen')
      4 
      5 local clear = n.clear
      6 local command = n.command
      7 local api = n.api
      8 local feed = n.feed
      9 local eq = t.eq
     10 
     11 describe('matchparen', function()
     12  local screen --- @type test.functional.ui.screen
     13 
     14  before_each(function()
     15    clear { args = { '-u', 'NORC' } }
     16    screen = Screen.new(20, 5)
     17    screen:set_default_attr_ids({
     18      [0] = { bold = true, foreground = 255 },
     19      [1] = { bold = true },
     20    })
     21  end)
     22 
     23  it('uses correct column after i_<Up>. Vim patch 7.4.1296', function()
     24    command('set noautoindent nosmartindent nocindent laststatus=0')
     25    eq(1, api.nvim_get_var('loaded_matchparen'))
     26    feed('ivoid f_test()<cr>')
     27    feed('{<cr>')
     28    feed('}')
     29 
     30    -- critical part: up + cr should result in an empty line in between the
     31    -- brackets... if the bug is there, the empty line will be before the '{'
     32    feed('<up>')
     33    feed('<cr>')
     34 
     35    screen:expect([[
     36      void f_test()       |
     37      {                   |
     38      ^                    |
     39      }                   |
     40      {1:-- INSERT --}        |
     41    ]])
     42  end)
     43 end)